1 / 7

Java Programming Concepts and Practice

This chapter reviews Java concepts including keywords, data types, declaring variables, using Scanner class, and pseudocode to Java code conversion. Learn about constants, control structures, and interactive dialog boxes.

oraw
Download Presentation

Java Programming Concepts and Practice

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 2 Review Questions

  2. Find correct Answer • Every complete statement ends with a _____. • The data 72, ‘A’, “Hello”, 2.17 are examples of ______. • A group of statements, such as the contents of a class or a method, are enclosed in ______. • The keyword used to declare a constant is ______

  3. Find correct Answer • The characters //, /* or /** are used to mark the beginning of a _____. • The method in Scanner class used to read a string is ______. • The method in Scanner class used to read an integer is ______. • The class used to display dialog boxes is ______

  4. Find correct Answer • A variable must be declared before it can be used. True or False? • Variable names may begin with a number. True or False? • A left brace in a Java program is always followed by a right brace later in the program. True or False? • The value of variable declared with the final keyword can not be changed. True or False?

  5. Convert pseudocode to Java code • Store 20 in the speed variable. • Store 10 in the time variable. • Multiply speed by time and store the result in the distance variable. • Display the contents of the distance variable.

  6. Convert pseudocode to Java code • Store 172.5 in the force variable. • Store 27.5 in the area variable. • Divide area by force and store the result in the pressure variable. • Display the contents of the pressure variable.

  7. Write program • Write a program that declares the following: • A String variable named name • An int variable named age • A double variable named salary • Store your name, age and salary in these variable. The program then displays a message similar to the following: My name is Hoa, my age is 26 and I hope to earn $300 per month.

More Related