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:
In the above program, we created three integer variables a, b, and c initialized with 10, 20, and 0 respectively. Here, we used pre and post-increment operators with variable 'a' and 'b'. The pre-increment operator will evaluate before the expression and post-increment operator will evaluate after the expression.
The value of variable 'a' will be 11 and the value of 'b' will be 21 because of pre-increment operator. Let's evaluate the expression,
c = ++a + ++b * 2+a++;
Now remove all pre and post-increment operators from the expression,
c = a +b * 2+a; c = 11+21*2+11; c = 11+42+11’ c = 64;
Then post increment operator will evaluate for variable a then the final value of a will be 22.
Answer Question 2:
Output:
Explanation:
In the above program, we created a class Main that contains the main() method. The main() method is the entry point of the program. Here, we created two local variables Z and X initialized with 0.0 and 3.5F respectively.
Now evaluate the expression:
Z = (X*10-23)*Math.pow(2,0); Z = (3.5*10-23)*1; Z = (35.0-23)*1; Z = (12.0)*1; Z = 12.0
Answer Question 3:
Output:
Explanation:
In the above program, we created a class Main that contains the main() method. The main() method is the entry point of the program. Here, we created a local variables Z initialized with 0.
Now evaluate the expression:
Z += (Float.SIZE/8)+ (Math.pow(2,3)%3); Z += (32/8)+(8%3); Z += (4)+(2); Z += 6; Z = Z + 6; Z = 0 + 6; Z = 6;
Answer Question 4:
Output:
Explanation:
The above program will generate syntax error because Char is not a built-in class in Java.
Answer Question 5:
Output:
Explanation:
The above program will generate syntax error because of const, to define a constant in java we need to use final keyword instead of const.
need an explanation for this answer? contact us directly to get an explanation for this answer