Вы находитесь на странице: 1из 2

Q . Write a program to print the square of first 10 Number using Method. Q.

Write a program to store the marks of 10 students in an array. Accept these marks as command line argument and display their sum and average. Q. Write a program to print first 20 numbers in the Fibonacci sequence. Eg. 1, 2, 3,5,8,13,21 Q. Write a program comprising a class Calculator. Define two variables. Write method for performing the operation of addition, subtraction, multiplication and division. Make use of Constructor in this program. Q. Create a class Doctor which contains basic information about doctors. There are two categories of doctors. Extends the Doctor class to represent Specialists and Non Specialist. Specialists contain the basic information like name, idnumber and address. It also contains specialist specific information like specialty . Similarly NonSpecialist also contains basic information like name, id_Number and address. Declare objects of these classes and display their respective information.

Q. What are the differences between throw and throws clause in Exception handling? Show example.

Q. Write a program called InsuranceCalculator for an insurance company. The program must accept a persons year of birth in yyyy format (ex. 2012). The program will calculate first the persons age by subtracting the year of birth from the year 2012. Then it will calculate the driving experience by subtracting 18 from their age. People who have been driving less than 4 years get charged $1000 a year for insurance , otherwise $600. If a person age is less than 18 they do not need insurance. The program should throw and exception message Too young for Insurance for the same.

Q. Write a program that accepts and count the number of digits entered as command line argument. If an alphabet is entered instead of a number , then error message should be displayed .

Q. Write a program that show that given string is palindrome or not using classes in different package. Q. What is a Java package and how is it used? Q. What is meant by final class, methods and variables? Q. What is method overriding? Define with example. Q. What is the Java Virtual Machine?

Q. What is the difference between final, finally and finalize? Q. What is meant by "A bstract class and Interface"? Explain with example ?

Вам также может понравиться