Absolute Java (6th Edition)
6th Edition
ISBN: 9780134041674
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 2, Problem 1STE
Explanation of Solution
Given: The line of code:
String s = “Hello� + “Joe�;
System.out.println(s);
To find: The output of the string:
String s = “Hello� + “Joe�;
System.out.println(s);
Solution:
The statement is written in Java language.
In the line: String s = “Hello� + “Joe�;
There is a variable which has the string as a data type. The two words, Hello and Joe, are concatenated by the + (plus) symbols.
System.out.println(s);
This line will provide the output, HelloJoe, which is the value of the string variable. The statement System.out.println is provided for showing the output on the console
Want to see more full solutions like this?
Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
5- What is the output for y?
int y = 0;
for (int i = 0; i< 10; ++i)
{
y +=i;
}
cout << y;
Write the lines(s) of code required to instantiate a patient object called sick and set that
patient's heart rate to 75. You may choose the values of other parameters for this patient, but only
use methods/constructors that have been provided (or that you wrote) on the the previous page).
9. What will the following print out?
= 0;
int num
System.out.println("Song titles with numbers include: ");
switch (num) {
case 12:
System.out.println("12 days of Christmas");
case 99:
System.out.println("99 bottles of beer on the wall");
System.out.println("99 Luftballons");
case 7:
System.out.println("7 Chinese Brothers");
case 50:
System.out.println("50 Mission Cap");
default:
System.out..println ("If I had a million dollars");
А.
Song titles with numbers include:
7 Chinese Brothers
50 Mission Cap
If I had a million dollars
В.
Song titles with numbers include:
7 Chinese Brothers
С.
Song titles with numbers include:
12 Days of Christmas
99 bottles of beer on the wall
99 LuftBallons
7 Chinese Brothers
D.
Song titles with numbers include:
If I had a million dollars
Chapter 2 Solutions
Absolute Java (6th Edition)
Ch. 2 - Prob. 1STECh. 2 - Write Java statements that will cause the...Ch. 2 - What is the difference between System.out.println...Ch. 2 - Prob. 4STECh. 2 - What output is produced by the following code?
Ch. 2 - What output is produced by the following code? For...Ch. 2 - Write a Java statement to output the value in...Ch. 2 - What output is produced by the following code?...Ch. 2 - Suppose the class Robot is a part of the standard...Ch. 2 - Write an import statement that makes the Scanner...
Ch. 2 - Prob. 11STECh. 2 - Write a line of code that uses the object frank...Ch. 2 - Write a complete Java program that reads in a line...Ch. 2 - Write a complete Java program that reads in a line...Ch. 2 - Something could go wrong with the following code....Ch. 2 - Suppose your code creates an object of the class...Ch. 2 - Continue with the object keyboard from Self-Test...Ch. 2 - Prob. 18STECh. 2 - What is missing from the following code, which...Ch. 2 - The Babylonian algorithm to compute the square...Ch. 2 - (This is a version with input of an exercise from...Ch. 2 - Write a program that reads in two numbers typed on...Ch. 2 - John travels a distance of 55 miles at an average...Ch. 2 - Grade point average (GPA) in a 4-point scale is...Ch. 2 - (This is a better version of an exercise from...Ch. 2 - Write a program that determines the change to be...Ch. 2 - Write a program that reads in a string containing...Ch. 2 - (This is a better version of an exercise from...Ch. 2 - Write a program that inputs the name, quantity,...Ch. 2 - Write a program that calculates the total grade...Ch. 2 - (This is a variant of an exercise from Chapter 1.)...Ch. 2 - (This is an extension of an exercise from Chapter...Ch. 2 - From Programming Project 10 in Chapter 1,...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- 8. What will the following print out? int num = 7; System.out.println("Song titles with numbers include: "); switch (num) { case 12: System.out.println ("12 days of Christmas"); case 99: System.out.println("99 bottles of beer on the wall"); System.out.println ("99 Luftballons"); case 7: System.out.println ("7 Chinese Brothers"); case 50: System.out.println("50 Mission Cap"); default: System.out.println("If I had a million dollars"); } А. Song titles with numbers include: 7 Chinese Brothers 50 Mission Cap If I had a million dollars В. Song titles with numbers include: 7 Chinese Brothers С. Song titles with numbers include: 12 Days of Christmas 99 bottles of beer on the wall 99 LuftBallons 7 Chinese Brothers D. Song titles with numbers include:arrow_forwardwhat will be the output of the code given below:String name = " Juan Dela Cruz"; double age = 56. System.out.println(Name); Juan Dela Cruz error 56arrow_forwardAssigning values to variables What will be the values of the variables a, b and c after executing the following code? int a: int b: int c: a=10: b=11: C=8: a=b:arrow_forward
- Analyze the following code: int x = 0;if (x > 0) ;{System.out.println(x);} The code has syntax error. The code has run time error. The value of variable x is always printed because the print statement is not controlled by the if condition. Nothing is printed because x > 0 is false if x = 0.arrow_forwarda. What is wrong in the following code? i. double a = 7.0; int* p = sa; ii. int test = 1; int* pTest = &test; int i = pTest;arrow_forwardoptions same for each onearrow_forward
- 33. What is the output of the following Java code? int x =3; do { System.out.print(x + " ");}while (x >= 1); System.out.println();arrow_forwardWrite code that outputs variable numMonths as follows. End with a newline. Ex: If the input is: 3 the output is: Months: 3 Phyton codearrow_forwardString tmpStr = "Mickey"; String message = "Hello" + tmpStr; System.out.println (message); tmpStr "Minnie"; System.out.println (message); What is the output?arrow_forward
- What’s the outputInt x =4;If (x < 4) {x = x+1;}System.out.printlin(“x is “ + x);arrow_forwardWhat is the output of the following statement: string s1 = "85"; string s2 = "95"; string s3 = "90"; System.out.println(s1 + s2 + s3);arrow_forwardcan you please write it in java.util.scanner form Write a program that prompts the user to enter a number within the range of 1 through 10. The program should display the Roman numeral version of that number. If the number is outside the range of 1 through 10, the program should display an error message. but use switch statement for the program.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,