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 an integer array arr with 5 values. We also created three local variables NUM, I, and J initialized with 0. Here we find prime numbers from the array and print them on the console screen.
Note: Prime numbers are those numbers that can only divide by 1 or itself. But 2 is the lowest prime number.
In the given array 7, 11, and 17 are the prime numbers.
Answer Question 2:
Output:
Explanation:
The above program will generate syntax error because we initialized float array with double values, here we need to use values with suffix "F".
The correct way is given below:
float[] floatArr = { 20.2F, 21.4F, 32.4F };
Answer Question 3:
Output:
Explanation:
In the above program, we created an array of float values. Then we used for each loop. The for each loop is used to access values from array one by one.
Here, we find the remainder of each value and print on the console screen.
Answer Question 4:
Output:
Explanation:
In the above program, we created an array floatArr1 of float values and then assign the reference of array floatArr1 to array floatArr1. Then we used for each loop with array floatArr2 and access each element from array one by one.
Here, we find the remainder of each value and print on the console screen.
Answer Question 5:
Output:
Explanation:
The above program will generate syntax error because we used single quotes with string instead of double-quotes.
Note: Single quotes are used for a single character and double quotes are used for the string in Java.
need an explanation for this answer? contact us directly to get an explanation for this answer