Java Programming Concepts and Examples
Classified in Computers
Written on in
with a size of 10.2 KB
Palindrome
- Start
- Read the string
- Calculate the length of the string
- Initialize rev
- Initialize i=length=1
- Repeat until i>=0
- rev=rev+char at position I of the string
- i=i-1
- If string=rev:print “palindrome”
- Else print “not palindrome”
- Stop
import java.util.Scanner; import java.util.Scanner; class Test { public static void main(String args[]){ Scanner sc = new Scanner(System.in); System.out.print("Enter the String:"); String str = sc.nextLine(); int flag = 0; int len = str.length(); for(int i=0;i
Inheritance
- Create a class employee with given variables and method print the salary
- Create two sub classes of class employee named officer and manager include the variable specilaization in officer class and department in manager class
- Create a class with main