Given the code fragment: What is the result?
A.
An exception is thrown at runtime
B.
1.0, 1
C.
1.0f, 1
D.
7.33, 7
E.
Compilation fails
Given the code fragment: What is the result?
Given the code fragment: What is the result?
A.
An exception is thrown at runtime
B.
1.0, 1
C.
1.0f, 1
D.
7.33, 7
E.
Compilation fails
Answer: B
Code question:
public class Main {
public static void main(String[] args) {
float x = 22.00f % 3.00f;
int y = 22 % 3;
System.out.println(x + “, “+ y);
}
}
Output:
1.0, 1