JAVA Assignment-1
Descriptive Questions:
1. Why is Java platform-independent?
2. What is java virtual machine?
3. Define following terms: Class, object, encapsulation, inheritance, polymorphism.
4. What are eight basic types in java?
5. What are two steps to create an array?
6. What are three types of java comments?
7. What is significance of main method in java?
8. What is the scope of variable?
9. What is a constructor?
10. What is method overloading?
11. Contrasts method overloading and method overriding.
12. What are the various access specifiers for Java classes?
13. What are Loops in Java? What are three types of loops?
14. What's the purpose of Static methods and static variables?
Programs:
1. Write a java program to find input value is Armstrong number or not.
2. Write a java program to find input value is Palindrome number or not.
3. Write a java program to generate a Fibonacci series.
4. Write a java program to find number is prime or not.
5. Find out biggest between 3 integer using ternary operator, 3 numbers should come from
command line.
6. Write a java program to input some kind of information of a person from the keyboard.
Age of a person
Height of a person
Weight of a person and display it in the following manner. e.g.
So, you're 35 years old, 6'2" tall and 60KG heavy.
7. A 4-digit number is entered through keyboard. Write a program to print a new number with
digits reversed as of original one. E.g.-
INPUT: 1234 OUTPUT: 4321
INPUT: 5982 OUTPUT: 2895
8. Write down the names of 10 of your friends in an array and then sort those in alphabetically
ascending order.
9. Write a following pattern:
1
12
123
10. Create a person inherit two classes from it politician & sportsman provide constructors &
calculate salary and display functions.