Q:
Java find output programs (Class and Objects) | set 3
belongs to collection: Java find output programs
Java find output programs
- Java find output programs (Data Types) | set 1
- Java find output programs (Data Types) | set 2
- Java find output programs (Data Types) | set 3
- Java find output programs (Operators) | set 1
- Java find output programs (Operators) | set 2
- Java find output programs (Operators) | set 3
- Java find output programs (if else) | set 1
- Java find output programs (if else) | set 3
- Java find output programs (switch case) | set 1
- Java find output programs (switch case) | set 2
- Java find output programs (switch case) | set 3
- Java find output programs (Loops) | set 1
- Java find output programs (Loops) | set 2
- Java find output programs (Loops) | set 3
- Java find output programs (Arrays) | set 1
- Java find output programs (Arrays) | set 2
- Java find output programs (Arrays) | set 3
- Java find output programs (this Keyword) | set 1
- Java find output programs (final Keyword) | set 1
- Java find output programs (final Keyword) | set 2
- Java find output programs (static Keyword) | set 1
- Java find output programs (static Keyword) | set 2
- Java find output programs (Parameter Passing) | set 1
- Java find output programs (Class and Objects) | set 1
- Java find output programs (Class and Objects) | set 2
- Java find output programs (Class and Objects) | set 3
- Java find output programs (Constructor & Destructor) | set 1
- Java find output programs (Constructor & Destructor) | set 2
- Java find output programs (Constructor & Destructor) | set 3
- Java find output programs (Inheritance) | set 1
- Java find output programs (Inheritance) | set 2
- Java find output programs (Inheritance) | set 3
- Java find output programs (Interface) | set 1
- Java find output programs (Interface) | set 2
- Java find output programs (Interface) | set 3
- Java find output programs (Overloading) | set 1
- Java find output programs (Overloading) | set 2
- Java find output programs (Overriding) | set 1
- Java find output programs (Overriding) | set 2
- Java find output programs (Overriding) | set 3
- Java find output programs (Exception Handling) | set 1
- Java find output programs (Exception Handling) | set 2
- Java find output programs (Exception Handling) | set 3
- Java find output programs (Enumeration) | set 1
- Java find output programs (Enumeration) | set 2
- Java find output programs (Autoboxing & Unboxing) | set 1
- Java find output programs (Autoboxing & Unboxing) | set 2
- Find output programs (Java String class)
- Find Output of Java program - 1 (Mixed topics)
- Find Output of Java program - 2 (Mixed topics)
- Java find output programs (if else) | set 2
Answer Question 1:
Output:
Explanation:
The above program will generate compile-time errors because in the above program we created pointer ptr in the main() method, but Java does not support pointers.
Answer Question 2:
Output:
Explanation:
The above program will generate a compile-time error because of the below statement,
System.out.println(sizeof(S));
In the above statement, we used sizeof() to get the size of object S. The sizeof() is not built-in operator in Java.
Answer Question 3:
Output:
Explanation:
In the above program, we created a Student class that contains data member id, name, and fees and we also created two methods setInfo() and printInfo().
The setInfo() is used to set the data members of the Student class and the printInfo() method is used to print the information of the Student class.
In the main() method, we created the object of the Student class. Then we print object S using println() method than "Student@6d06d69c" will be printed on the console screen.
Answer Question 4:
Output:
Explanation:
In the above program, we created a Student class that contains data member id, name, and fees and we also created two methods setInfo() and printInfo().
The setInfo() is used to set the data members of the Student class and the printInfo() method is used to print the information of the Student class.
In the main() method we created object S and set values of data members using the setInfo() method and then print the size of the object using the getSize() method on the console screen.
Answer Question 5:
Output:
Explanation:
In the above program, we created a Student class that contains data member id, name, and fees and we also created two methods setInfo() and printInfo().
The setInfo() is used to set the data members of the Student class and the printInfo() method is used to print the information of the Student class.
In the main() method we created two object S1 and S2 and then set values of data members using the setInfo() method and then print the size of objects S1 and S2 using the getSize() method on the console screen.
need an explanation for this answer? contact us directly to get an explanation for this answer