Big Java Late Objects
2nd Edition
ISBN: 9781119330455
Author: Horstmann
Publisher: WILEY
expand_more
expand_more
format_list_bulleted
Question
Chapter 1, Problem 9RE
Program Plan Intro
Compilation error:
Compilation error is an error that occurs when a compiler fails to compile the
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
public class Test {
}
public static void main(String[] args) {
int a = 5;
a += 5;
}
switch(a) {
case 5:
}
System.out.print("5");
break;
case 10:
System.out.print("10");
System.out.print("0");
default:
Find error and correct it :
public class ProgramLayout
{
public static void main (String[] args)
{
final double PI = 3.14159;
double x;
double sum = x+PI ;
System.out.println (sum);
} // end class
public class TestShape
{
public static void main(String[] args)
{
/*
Circle c1 = new Circle(2.67);
System.out.println("c1: ");
System.out.println(c1.toString());
System.out.println();
Circle c2 = new Circle(3, false, "Red");
System.out.println("c2: ");
System.out.println(c2.toString());
System.out.println();
Rectangle r1 = new Rectangle(3, 2, true, "Blue");
System.out.println("r1: ");
System.out.println(r1.toString());
System.out.println();
Rectangle r2 = new Rectangle(3.2, 4, false, "Red");
System.out.println("r2: ");
System.out.println(r2.toString());
*/
}
}
Chapter 1 Solutions
Big Java Late Objects
Ch. 1.1 - What is required to play music on a computer?Ch. 1.1 - Why is a CD player less flexible than a computer?Ch. 1.1 - What does a computer user need to know about...Ch. 1.2 - Prob. 4SCCh. 1.2 - Which part of the computer carries out arithmetic...Ch. 1.2 - A modern smartphone is a computer, comparable to a...Ch. 1.3 - What are the two most important benefits of the...Ch. 1.3 - Prob. 8SCCh. 1.4 - Prob. 9SCCh. 1.4 - Prob. 10SC
Ch. 1.5 - How do you modify the HelloPrinter program to...Ch. 1.5 - How would you modify the HelloPrinter program to...Ch. 1.5 - Would the program continue to work if you replaced...Ch. 1.5 - What does the following set of statements print?...Ch. 1.5 - What do the following statements print?...Ch. 1.6 - Suppose you omit the "" characters around Hello,...Ch. 1.6 - Suppose you change println to Printline in the...Ch. 1.6 - Suppose you change main to hello in the...Ch. 1.6 - Prob. 19SCCh. 1.6 - Prob. 20SCCh. 1.7 - Prob. 21SCCh. 1.7 - Suppose your cell phone carrier charges you 29.95...Ch. 1.7 - Consider the following pseudocode for finding the...Ch. 1.7 - Suppose each photo in Self Check 23 had a price...Ch. 1.7 - Prob. 25SCCh. 1.7 - Prob. 26SCCh. 1 - Explain the difference between using a computer...Ch. 1 - Prob. 2RECh. 1 - Prob. 3RECh. 1 - Prob. 4RECh. 1 - Prob. 5RECh. 1 - Prob. 6RECh. 1 - What does this program print? public class Test {...Ch. 1 - What does this program print? Pay close attention...Ch. 1 - Prob. 9RECh. 1 - Write three versions of the HelloPrinter.java...Ch. 1 - How do you discover syntax errors? How do you...Ch. 1 - The cafeteria offers a discount card for sale that...Ch. 1 - Write an algorithm to settle the following...Ch. 1 - Consider the question in Exercise R1.13. Suppose...Ch. 1 - In order to estimate the cost of painting a house,...Ch. 1 - In How To 1.1, you made assumptions about the...Ch. 1 - Suppose you put your younger brother in charge of...Ch. 1 - Write pseudocode for an algorithm that describes...Ch. 1 - The ancient Babylonians had an algorithm for...Ch. 1 - Write a program that prints a greeting of your...Ch. 1 - Write a program that prints the sum of the first...Ch. 1 - Write a program that prints the product of the...Ch. 1 - Write a program that prints the balance of an...Ch. 1 - Write a program that displays your name inside a...Ch. 1 - Write a program that prints your name in large...Ch. 1 - Write a program that prints your name in Morse...Ch. 1 - Write a program that prints a face similar to (but...Ch. 1 - Write a program that prints an imitation of a Piet...Ch. 1 - Write a program that prints a house that looks...Ch. 1 - Write a program that prints an animal speaking a...Ch. 1 - Write a program that prints three items, such as...Ch. 1 - Write a program that prints a poem of your choice....Ch. 1 - Write a program that prints the United States...Ch. 1 - Type in and run the following program. Then modify...Ch. 1 - Type in and run the following program. Then modify...Ch. 1 - Modify the program from Exercise E1.16 so that the...Ch. 1 - Prob. 18PECh. 1 - Write a program that prints a two-column list of...Ch. 1 - In the United States there is no federal sales...Ch. 1 - To speak more than one language is a valuable...Ch. 1 - You want to decide whether you should drive your...Ch. 1 - You want to find out which fraction of your cars...Ch. 1 - The value of can be computed according to the...Ch. 1 - Imagine that you and a number of friends go to a...Ch. 1 - Write an algorithm to create a tile pattern...Ch. 1 - Write an algorithm that allows a robot to mow a...Ch. 1 - Consider a robot that is placed in a room. The...Ch. 1 - Consider a robot that has been placed in a maze....Ch. 1 - Suppose you received a loyalty promotion that lets...Ch. 1 - A television manufacturer advertises that a...Ch. 1 - Cameras today can correct red eye problems caused...
Knowledge Booster
Similar questions
- class main { public static void main(String args[]) { int x =2; int y =0; for(; y <10;++y) { if(y % x ==0) continue; elseif(y ==8) break; else System.out.print(y +" "); } } } Give result for the code Java Try to do ASAParrow_forwardclass Exam { public static void main(String[] args) { X x = new X(); System.out.printIn(x.value); } } O a. public O b. private O c. protected O d. None of the abovearrow_forwardclass Output{public static void main(String args[]){int x = 3.14;int y = (int) Math.abs(x);System.out.print(y);}} The output of the above Java code is ?arrow_forward
- Fix all errors to make the code compile and complete. //MainValidatorA3 public class MainA3 { public static void main(String[] args) { System.out.println("Welcome to the Validation Tester application"); // Int Test System.out.println("Int Test"); ValidatorNumeric intValidator = new ValidatorNumeric("Enter an integer between -100 and 100: ", -100, 100); int num = intValidator.getIntWithinRange(); System.out.println("You entered: " + num + "\n"); // Double Test System.out.println("Double Test"); ValidatorNumeric doubleValidator = new ValidatorNumeric("Enter a double value: "); double dbl = doubleValidator.getDoubleWithinRange(); System.out.println("You entered: " + dbl + "\n"); // Required String Test System.out.println("Required String Test:"); ValidatorString stringValidator = new ValidatorString("Enter a required string: "); String requiredString =…arrow_forwardFix all errors to make the code compile and complete.//MainValidatorA3 public class MainA3 { public static void main(String[] args) { System.out.println("Welcome to the Validation Tester application"); // Int Test System.out.println("Int Test"); ValidatorNumeric intValidator = new ValidatorNumeric("Enter an integer between -100 and 100: ", -100, 100); int num = intValidator.getIntWithinRange(); System.out.println("You entered: " + num + "\n"); // Double Test System.out.println("Double Test"); ValidatorNumeric doubleValidator = new ValidatorNumeric("Enter a double value: "); double dbl = doubleValidator.getDoubleWithinRange(); System.out.println("You entered: " + dbl + "\n"); // Required String Test System.out.println("Required String Test:"); ValidatorString stringValidator = new ValidatorString("Enter a required string: "); String requiredString =…arrow_forwardpublic class Turn{public static void main(String[] args){// Different initial values will be used for testingint x = 1; int y = 1; // Turn the arrow by 90 degrees System.out.print("x:", y + 90);System.out.println(x);System.out.print("y: ", x - 1 );System.out.println(y); // Turn the arrow again System.out.print("x:", y - 1);System.out.println(x);System.out.print("y: ",x + 90);System.out.println(y);}}arrow_forward
- Don't met it do sap.arrow_forwardclass class { public static void main(String args[]) { int a =5; int b =10; first: { second: { third: { if(a == b >>1) break second; } System.out.println(a); } System.out.println(b); } } } Give result for the code Java Try to do ASAParrow_forwardIdentify the error(s) in the program and describe why this error occurs. Rewrite the code after correcting all errors. package Overview interface MyInt{ int a; void seta(int alpha); } public class CheckTest implements MyInt { @Override public void seta(int alpha) {a = alpha;} public static void main(String[] args) { seta(5); } }arrow_forward
- Complete the isExact Reverse() method in Reverse.java as follows: The method takes two Strings x and y as parameters and returns a boolean. The method determines if the String x is the exact reverse of the String y. If x is the exact reverse of y, the method returns true, otherwise, the method returns false. Other than uncommenting the code, do not modify the main method in Reverse.java. Sample runs provided below. Argument String x "ba" "desserts" "apple" "regal" "war" "pal" Argument String y "stressed" "apple" "lager" "raw" "slap" Return Value false true false true true falsearrow_forwardpublic class Geometry{public static void main(String[] args){//asks for user's choice Scanner in = new Scanner(System.in);displayMenu();selectOption(choice);System.out.println("Enter your choice (1-3): ");int choice1 = in.nextInt();System.out.println("Thanks for using the Geometry Calculator - Goodbye!");//Prints if input is a number that is not one of the choiceswhile(choice1 < 1 || choice1 > 3 ){System.out.println("Invalid choice. Please enter 1 - 3: ");choice1 = in.nextInt();}}/**Displays the menu*/public static void displayMenu(){System.out.println("Welcome to the Geometry Calculator Application");System.out.println("1. Calculate the Area of a Circle");System.out.println("2. Calculate the Area of a Rectangle");System.out.println("3. Calculate the Area of a Triangle");}/** This method calculates the area of the circle@return the area of the circle*/public static double circle()// calculates the area of the circle{Scanner in = new Scanner(System.in);System.out.println("What is…arrow_forwardAnalyse the following code. public class Test { int x; public Test(String t) { System.out.println("Test"); } public static void main(String[] args) { Test test = new Test(); System.out.println(test.x); } } A. The program has a compile error because you cannot create an object from the class that defines the object. B. The program has a compile error because System.out.println method cannot be invoked from the constructor. C. The program has a compile error because x has not been initialized. D. The program has a compile error because Test does not have a default constructor.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education