You are not logged in.

#1 2015-06-10 06:48:07

husnain
User RankUser RankUser RankUser RankUser RankUser Rank
Administrator
From: Chichawatni,Pakistan
Registered: 2014-10-03
Posts: 8,129
Website

Java Output:

Question:
What output you will get if you run this program?
class Modulus {
public static void main(String args[]) {
int x = 42;
double y = 42.25;
System.out.println("x mod 10 = " + x % 10);
System.out.println("y mod 10 = " + y % 10);
}
}

Option A):
x mod 10 = 4
y mod 10 = 2.50
Option B):
x mod 10 = 6
y mod 10 = 3.25
Option C):
x mod 10 = 2
y mod 10 = 2.25
Option D):
x mod 10 = 2
y mod 10 = 4.25

Correct Answer is Option C):
x mod 10 = 2
y mod 10 = 2.25


You cannot discover the new oceans unless you have the courage to lose the sight of the shore.

2015-06-10 06:48:07

Advertisement
Ads By Google

Re: Java Output:



Board footer