0% found this document useful (0 votes)
50 views

Q

The document contains several questions related to Java programming concepts and tasks. It asks to write programs to: 1) Print the square of the first 10 numbers using a method. 2) Store marks of 10 students in an array and display sum and average. 3) Print the first 20 Fibonacci numbers. 4) Perform basic math operations using a Calculator class. 5) Create Doctor classes to represent specialists and non-specialists. It also asks about differences between throw and throws in exception handling and defines some insurance calculation logic. Other questions relate to packages, final keywords, overriding, JVM, final vs finally vs finalize, abstract classes vs interfaces.

Uploaded by

narayannpp
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Q

The document contains several questions related to Java programming concepts and tasks. It asks to write programs to: 1) Print the square of the first 10 numbers using a method. 2) Store marks of 10 students in an array and display sum and average. 3) Print the first 20 Fibonacci numbers. 4) Perform basic math operations using a Calculator class. 5) Create Doctor classes to represent specialists and non-specialists. It also asks about differences between throw and throws in exception handling and defines some insurance calculation logic. Other questions relate to packages, final keywords, overriding, JVM, final vs finally vs finalize, abstract classes vs interfaces.

Uploaded by

narayannpp
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 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 ?

You might also like