• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

questions mock

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Javaranchers ! found these questions in newboone's exam , but answers were not given , please tell me the answers to these three
How you can use the escape notation \u to set the variable c, declared as a char, to the Unicode character whose value is hex 0x30A0?

Another question
What letters get written to the standard output with the following code? class Unchecked {
public static void main(String[] args) {
try {
method();
} catch (Exception e) {
}
}

static void method() {
try {
wrench();
System.out.println("a");
} catch (ArithmeticException e) {
System.out.println("b");
} finally {
System.out.println("c");
}
System.out.println("d");
}

static void wrench() {
throw new NullPointerException();
}
}

Select all valid answers.
"a"
"b"
"c"
"d"
none of these

If you supply a target object when you create a new Thread, as in: Thread t = new Thread(targetObject);
What test of instanceof does targetObject have to pass for this to be legal?
Select the one right answer.
targetObject instanceof Thread
targetObject instanceof Object
targetObject instanceof Applet
targetObject instanceof Runnable
targetObject instanceof String
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
char c = '\u30A0'
targetObject must be Runnable
for the exception question, you're best to work through it and/or run the code yourself,
Alex
 
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Explanation for the exception question.

So it prints only c.
Hope this helps,
Vanitha.

[This message has been edited by Vanitha Sugumaran (edited August 12, 2001).]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic