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 syntax error because variable r is not declared in the above program but we used variable r in the below statement,
System.out.println(r);
Answer Question 2:
Output:
Explanation:
In the above program, we declared three variables Val, r1, and r2 initialized with 1235, 0, and 0 respectively. Here, we find the reverse of variable Val. Here, r1 variable is used to get the remainder that is the last digit of the number. Then we divide val by 10 every time it will be divided until it becomes 0, and we got the final reversed number in the variable r2 and that will be printed on the console screen.
Answer Question 3:
Output:
Explanation:
The above program will generate syntax errors because of for loop, we did not declare variable j correctly.
The correct way is given below,
for (int i = 0,j = 0; i < val; i++, j++)
Answer Question 4:
Output:
Explanation:
In the above program, we created a variable val initialized with 5. Here, we used a nested loop, where the outer loop is used for the number of rows printed, and the inner loop will print execute according to the value of K.
For K=1; It will print 1 For K=2; It will print 1 2 For K=3; It will print 1 2 3 For K=4; It will print 1 2 3 4 For K=5; It will print 1 2 3 4 5 Then the loop will terminate.
Answer Question 5:
Output:
Explanation:
The loop will execute infinite times because we used decrement operator with variable K that why condition will never false and the loop will not terminate.
need an explanation for this answer? contact us directly to get an explanation for this answer