Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

java_basics_assignment

The document outlines a series of Java programming tasks, including class definitions, method overloading, and interface applications. It covers various concepts such as constructors, arithmetic operations, exception handling, and file I/O. Additionally, it poses questions regarding the behavior of final variables and methods, as well as the implications of using interfaces in multithreading.

Uploaded by

melakuzegeyed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

java_basics_assignment

The document outlines a series of Java programming tasks, including class definitions, method overloading, and interface applications. It covers various concepts such as constructors, arithmetic operations, exception handling, and file I/O. Additionally, it poses questions regarding the behavior of final variables and methods, as well as the implications of using interfaces in multithreading.

Uploaded by

melakuzegeyed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Define any class with its member and implement two constructor (overload constructor)
that can be initialize half or all fields and create two objects to print the values of all fields
by using different field name and parameter name?
2. What is the exact value of an object, write a java code to know the value of an object?
3. Create a class that define four methods respect to the four arithmetic operation and create
another class in different package to apply the four-arithmetic operation by taking two
number from the user?
4. Write a java code to implement the following problem. Use different method to perform
each operation. Don’t write any piece of code in a main method rather than calling only
one method. One method must invoke another method for farther information or
calculation.
A. Input grade point for three courses and calculate latter grade for each course? Also,
calculate average number grade and average letter grade? Use at least three methods.
B. Assume you will take a cup of tea with pizza for a breakfast. Calculate the total cost
of the meal with a tax of 15%? Use at least three methods in which one is invoked
the other.
C. If you are sleep for 6 hours, you are miss some of your health, but you are cover your
study and become clever. If you are sleep for 8 hours, your health status is normal,
but you are not good academically. Write a java code that identify your status?
5. Write a java code with private and final method. Try to override both method in a subclass?
6. Overload method by differing only return type? What do you conclude?
7. Implement method overloading for all three arithmetic operators starting from one
parameter up-to five number of parameters?
8. Define final variable and try to change its value in a subclass?
9. Create a final class and try to derive another class from it?
10. What you are conclude from the results of question number 8 and 9?
11. define final and static method in an interface?
12. can you define non-abstract method and non-constant fields in an interface? if so, how? if
it is impossible; why?
13. can we use private, protected and default-package modifier for overriding method in the
implementing class? if we can’t, why?
14. what is an application of an interface (consider multithreading)?
15. What problem is solved using an interface?
16. what is happen if we cannot implement some method of interface in implementing class?
17. write a java code to read from binary file and write to binary file?
18. Accept 5 array element and try to access the 6th element?
19. Write a java code that can be throw ClassNotFound exception?
20. What will be happen if we use finally block without try block?

You might also like