Question: 1) Analyze the following statements in Java and Justify how and when the values are stored in stack / heap memory. int number1 = 78;
1) Analyze the following statements in Java and Justify how and when the values are stored in stack / heap memory. int number1 = 78; Integer number2 = new Integer(78); bool result = number1==number2; System.out.println(result);
2) Create a Student.java program and Complete the App.java with the following requirements: Student.java: [i] Fields: name and regno age and studentCount Methods: checkAge (if age is less than 18, then consider only the default value) [ii] No-Arg constructor: Assign 4 asterisk for strings and a default value 18 for age. [iii] Parameterized constructor: if partial fields are passed, then assign values through No-Arg constructor. Also, validate the age field with checkAge methods. if all values are passed, then assign the values to respective fields. Also, validate the age field with checkAge method. [v] Display the total objects created for Student class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
