java questions

1
7/17/2019 Java Questions http://slidepdf.com/reader/full/java-questions-568f71e16db8f 1/1  Java Questions Time: 45min 1. What if I do not provide the String array as the agrument to the main method? 2. an an app!i"ation have mu!tip!e "!asses having main method?  Justify. #. an I have mu!tip!e main methods in the same "!ass? 4. What if I $rite stati" pu%!i" void instead of pu%!i" stati" void? 5. What are the di&erent $ays to hand!e e'"eptions? (. What are "he")ed e'"eptions? *. +o$ are ,this- and ,super- used $ith "onstru"tors? . What "!ass a!!o$s you to read o%/e"ts dire"t!y from a stream? 0. Write the J onne"tion String for 3ra"!e data%ase. 1. Write a simp!e program to read a !e %y using hara"ter Stream. 11. an you "a!! one "onstru"tor from another? 12. When is a method said to %e over!oaded and $hen is a method said to %e overridden? 1#. 6'p!ain di&erent $ays of "reating a thread. 14. Whi"h is true? a. 78 e'ends 9 is "orre"t if and on!y if 8 is a "!ass and 9 is an interfa"e %. 78 e'ends 9 is "orre"t if and on!y if 8 is an interfa"e and  9 is a "!ass ". 78 e'ends 9 is "orre"t if 8 and 9 are either %oth "!asses or %oth interfa"es d. 78 e'ends 9 is "orre"t for a!! "om%ination of 8 and 9 %eing "!asses and;or interfa"es 15.Write a program for !ass "asting $ith # "!asses<=>>.

Upload: sheeba-dhuruvaraj

Post on 08-Jan-2016

5 views

Category:

Documents


0 download

DESCRIPTION

java sample questions

TRANSCRIPT

Page 1: Java Questions

7/17/2019 Java Questions

http://slidepdf.com/reader/full/java-questions-568f71e16db8f 1/1

 Java Questions

Time: 45min

1. What if I do not provide the String array as the agrument tothe main method?

2. an an app!i"ation have mu!tip!e "!asses having main method?

 Justify.#. an I have mu!tip!e main methods in the same "!ass?4. What if I $rite stati" pu%!i" void instead of pu%!i" stati" void?5. What are the di&erent $ays to hand!e e'"eptions?(. What are "he")ed e'"eptions?*. +o$ are ,this- and ,super- used $ith "onstru"tors?. What "!ass a!!o$s you to read o%/e"ts dire"t!y from a stream?

0. Write the J onne"tion String for 3ra"!e data%ase.1. Write a simp!e program to read a !e %y using hara"ter

Stream.11. an you "a!! one "onstru"tor from another?12. When is a method said to %e over!oaded and $hen is a

method said to %e overridden?1#. 6'p!ain di&erent $ays of "reating a thread.14. Whi"h is true?

a. 78 e'ends 9 is "orre"t if and on!y if 8 is a "!ass and 9 is

an interfa"e%. 78 e'ends 9 is "orre"t if and on!y if 8 is an interfa"e and

 9 is a "!ass". 78 e'ends 9 is "orre"t if 8 and 9 are either %oth "!asses

or %oth interfa"esd. 78 e'ends 9 is "orre"t for a!! "om%ination of 8 and 9

%eing "!asses and;or interfa"es15.Write a program for !ass "asting $ith # "!asses<=>>.