Week3Assignment

Week3Assignment - = 2, e = 3, f = 4; int h = -c + d * (-e *...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Q1 What is the value of String result after the following lines? String s = "You're my best friend!"; String result = "Result string is" + s.substring(6); A. You're my best friend! B. my best friend C. Result string is You're my best friend! D. Result string is my best friend! E. Result string ismy best friend!
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Q2 Which of the following is an illegal assignment expression? A. int x = 2; B. float x = 2.0f; C. double x = 2.09; D. int x = 5.6f; E. double x = 7.89f;
Background image of page 2
3 Q3 What is the resulting value of the following java expression? int c = 1, d
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: = 2, e = 3, f = 4; int h = -c + d * (-e * f); A.-12 B.-25 C.-23 D. 25 E. 12 4 Q4 What keyword is used to specify that a variable is a constant? A. public B. static C. constant D. final E. import 5 Q5 class HelloWorld { public static void main ( String [ ] args ) { String test; System.out.println(test); } } Will the following program run? A. Yes. Outputs garbage value. B. Yes but compiler issues warning. C. No. Compiler Error. D. No. 'test' is not a valid variable name....
View Full Document

Page1 / 5

Week3Assignment - = 2, e = 3, f = 4; int h = -c + d * (-e *...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online