What will be the exact OP by these java statements Systemout
Solution
Answer :
2.What will be the exact O/P by these Java statements?
System.out.print(\"The most effective way to learn programming are \");
System.out.println(\"coding programs and run it\");
Answer :
The most effective way to learn programming are coding programs and run it
Explanation :
1st System.out.print statement will execute after System.out.println statement will execute. System.out.println statement print on same line.
..........................
Q3)
What will be the exact o/p by these java statements?
System.out.print(\"Java is powerful and it is \");
System.out.print(\"easy to learn.\");
Answer :
Java is powerful and it is easy to learn.
Explanation :
1st System.out.print statement will execute after System.out.print statement will execute. 2nd System.out.print statement print on same line.
..........................
Q4)
What will be the exact O/P by these java statements ?
System.out.print(\"The most effective way to learn programming is\ coding programs and run it.\");
Answer :
The most effective way to learn programming is
coding programs and run it.
Explanation :
System.out.print statement will execute.It will print upto \"programming is \" is in first line after \ code print in second line.
......................
Q6)
What will be the O/P produced by the following code:
System.out.print(\"ABC\ A\ B\ C\");
Answer :
Line1:ABC Line2:A Line3:B Line4:C
........................
Q10)
What will be the O/P of these codes:
int a=15;
int b=4;
int c=0,d=0,e=0;
c=a % b;
d=a / b;
c=a + b + c + d;
System.out.println(\"a=\"+a +\"\ b=\" +b +\"\ c=\"+c+\"\ d=\"+d+\"\ e=\"+e);
System.out.println(\"a=\"+a+\",b=\"+b+\",c=\"+c+\",d=\"+d+\",e=\"+e);
Answer :
Line(1) a=15
Line(2) b=4
Line(3) c=25
Line(4) d=3
Line(5) e=0
Line(6) a=15,b=4,c=25,d=3,e=0
.........................
Q11).
What O/P is produced by the following code?
int time=2,tide=3;
if(time + tide >6)
System.out.println(\"Time and tide wait for no one.\");
else
System.out.println(\"Time and tide wait for me.\");
Answer :
Time and tide wait for me.
Explanation :
int time=2,tide=3;
if(time + tide >6) //if(2 + 3 >6)------> 5>6 F //Condition is false so else statement will execute
System.out.println(\"Time and tide wait for no one.\");
else
System.out.println(\"Time and tide wait for me.\");
..........................


