Tough Homework Questions, PLEASE HELP!
Hello! Iím fairly new to the forum and I was wondering if I could get some help with a couple of tough homework questions that I have to do. If you could also provide a brief explanation that would be great but you donít have to. Thanks soo much!!!
1. What will print to screen?
a. Hexidecimal code of the object's source code
b. Object1's Class name and Object1's memory address
2. Which of the following is a literal string?
a. new String(a)
c. Char String
d. "Hello Philip"
3. What is the purpose for the following code segment?
somevariable = expression;
a. creates a method
b. compares values
c. an assignment operation
d. finds the variable in the expression
4. Which is a variable declaration only?
a. final float = 12;
b. private int MyNumber = 67;
c. char Initial;
d. int Age = 55;
5. Which of the following are valid commands? (MORE THAN ONE ANSWER!)
a. System.out.println("The amount is " + 99);
b. String values = 98 + 45;
c. String numbers = "7.8" + " 9.0 " + " 3.4 ";
d. String money = "$" + 45.90 + 22.45;
6. What primitive data type should be used for the following value?
7. What type of constant is '-49'? (POSSIBLY MORE THAN ONE ANSWER!)
8. If a decimal is changed to an int, _________.
a. The decimal is truncated
b. it cannot be changed
c. The decimal is rounded up
d. the decimal is rounded down
9. What is the output?
System.out.println("my numbers: " + 4 + 5);
a. my numbers:
b. invalid command error
c. my numbers: 45
d. my numbers: 9