Predict the answers to the following problems. 5 / 2.5 _______ 8 % 4 _______ 1 /
ID: 3663267 • Letter: P
Question
Predict the answers to the following problems.
5 / 2.5 _______
8 % 4 _______
1 / 3 _______
2 % 7 _______
3 / 2.0 _______
Write the following mathematical expressions as Java expressions:
2x - (4 - y)
x * 2
(2x -1 ) / 2x3
Answer the following exercised:
What output is produced by the following statements?
String test = “Harry Potter”;
System.out.println(test.length());
System.out.println(test.toUpperCase());
What output is produced by the following statements?
String test = “Harry Potter”;
System.out.println(test + “Goblet of Fire”);
Explanation / Answer
1.
5/2.5 = 2
8%4=0
1 / 3 =1
2 % 7 =2
3 / 2.=1
4.//problem to give output for below program
String test = “Harry Potter”;
//Here + is used to combine first and second statements into one.
System.out.println(test + “Goblet of Fire”);
output:
Harry Potter Goblet of Fire
3.
//program to get the ouput from test variable of type string
String test = “Harry Potter”;
//gets the length of the string vriable declared in test variable
System.out.println(test.length());
//converts into upper case
System.out.println(test.toUpperCase());
soln:
output:
case:1 length of test variable of type string is 11
case 2converts the given statemnts into upper case.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.