Information Technology Department
2nd Year
والطاقة
كليةتكنولوجياالصناعة
Faculty of Industrial and Energy Technolog
Course: JAVA (1) Lecturer: Dr. Mohammed AbdelFattah
Semester: 2nd term 2024/2025. Assistants: Engs. / Osama El-Samdouni, Hazem Hamdy, Mohamed Ehab, Menna Allah,
Israa Abdel Rasoul, Sarah El-Kharashi, Israa Mohsen
Assignment 2
Student Information
Name: alaa Hawary mohamed
Faculty ID: ………2320112……………… Mark: ………… / 10
Write T (True) or F (False):
Q1. A class may have multiple constructors. ( T)
Q2. Class does not allow constructors overloading. ( F)
Q3. Class does not have any constructor by default. ( F)
Q4. The setter method(s) is used to modify the instance variable(s). ( T)
Q5. The static method can be accessed by creating an object of the class. ( F)
Q6. A constructor in Java is a special method that is used to initialize objects. ( T)
Q7. The instance method can be accessed without creating an object of the class. ( F)
Q8. The constructor name may not match the class name, and it can have a return type. ( F)
Q9. Java enables you to pass a variable number of arguments of the same type to a method. ( T)
Q10. The getter method is used to read the instance variable and is known as the accessor method. ( T)
Information Technology Department
2nd Year
والطاقة
كليةتكنولوجياالصناعة
Faculty of Industrial and Energy Technolog
Q11.The static keyword refers that the attribute/method belongs to the class, rather than an object. (T )
Write the following program:
Q13. Develop a student class that contains the following data members (id, name, GPA,
universityName, and universityAddress) and has the following:
- Make these fields (universityName and universityAddress) as a static attribute.
- Create a “No-Args Constructor” that initializes the student information with default values.
- Create a “Parameterized Constructor” that passes initial values for student objects.
- Create getter and setter methods for these data members (id, name, and GPA).
- Create a static method that prints the university information.
- Create an instance method that prints student information.
Page 2 of 2
JAVA
PROGRAMMING
-