Java chapter 2

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

You can use this class to display dialog boxes a. JOptionPane b. BufferedReader c. InputStreamReader d. DialogBox

a. JOptionPane

true or false: a left brace in a java program is always followed by a right brace later in the program.

true

true or false: a variable must be declared before it can be used

true

true or false: you cannot change the value of a variable whose declaration uses the final key word

true

which of the following are not valid println statements? (indicate all that apply): a. System.out.println + "Hello World"; b. System.out.println("Have a nice day"); c. out.System.println(value); d. println.out(Programming is great fun);

a. System.out.println + "Hello world"; c. out.System.println(value); d. println.out(programming is great fun);

a group of statements, such as the contents of a class or a method, are enclosed in _________; a. braces {} b. parentheses () c. brackets [] d. any of these will do

a. braces {}

this type of operator lets you manually convert a value, even if it means that a narrowing conversion will take place. a. cast b. binary c. uploading d. dot

a. cast

which scanner class ethod would you use to read a double as input? a. nextDouble b. getDouble c. readDouble d. none of these; you can't

a. nextDouble

the negation operator is _______; a. unary b. binary c. ternary d. none of these

a. unary

these characters mark the beginning of a single-line comment a. // b. /* c. */ d. /**

a.//

These characters mark the beginning of a multi-line comment a. // b./* c.*/ d./**

b. /*

which of thee following are not valid assignment statements? (indicate all that apply); a. total = 9; b. 72 = amount; c. profit = 129 d. letter = 'w';

b. 72 = amount; c. profit = 129

The following data 72 'A' "Hello World" 2.8712 are all examples of __________; a. variables b. literals c. strings d. none of these

b. literals

Which Scanner class method would you use to read a string as an input? a. nextString b. nextLine c. readString d. getLine

b. nextLine

This key word is used to declare a named constant. a. constant b. namedConstant c. final d. concrete

c. final

Every complete statement ends with a _______: a. period b. parenthesis c. semicolon d. ending brace

c. semicolon

When Java converts a lower-ranked value to a higher-ranked type, it is called a(n) __________; a. 4-bit conversion b. escalating conversion c. widening conversion d. narrowing conversion

c. widening conversion

these characters mark the beginning of a documentation comment a. // b. /* c. */ d. /**

d. /**

true or false: comments that begin with // can be processed by javadoc.

false

true or false: if one of an operator's operands is a double, and the other operand is an int, java will automatically convert the value of the double to an int.

false

true or false: variable names may begin with a number.

false


Kaugnay na mga set ng pag-aaral

HESI Foundations and Practice of Mental Health Nursing

View Set

Finance Final (Chapter 4,5,6,7,8,9,11,13)

View Set

proj management weekly challenge 2

View Set

Pride and Prejudice Quotes 14 - 23

View Set

𝙀𝙑𝙀𝙍𝙔𝙈𝘼𝙉: GOOD DEEDS (463-521)

View Set

Chap 33 Post-war Great Britain: Reforms, Industry & Economy

View Set

Chapter 15: Benefit-Cost Analysis

View Set

Chapter 19 Macroeconomics - Exchange Rates

View Set