Q1. How could Java classes direct program messages to the system console, but error messages, say to a file?
A. The class System has a variable out that represents the standard output, and the variable err that represents the standard error device. By default, they both point at the system console. This how the standard output could be re-directed:
Stream st = new Stream(new FileOutputStream("output.txt")); System.setErr(st); System.setOut(st);
*Q2. What's the difference between an interface and an abstract class?
A. An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.
more.....!!!
A. The class System has a variable out that represents the standard output, and the variable err that represents the standard error device. By default, they both point at the system console. This how the standard output could be re-directed:
Stream st = new Stream(new FileOutputStream("output.txt")); System.setErr(st); System.setOut(st);
*Q2. What's the difference between an interface and an abstract class?
A. An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.
more.....!!!
Thursday, September 29, 2011
//
Labels:
JAVA Programming
//
0
comments
//
0 comments to "JAVA Interview Questions1"
Popular Posts
-
list of cups and trophies (Associated with Sports and Games) Sport: Hockey Aga khan Cup , Begam Rasul Torphy (woman’s), Maharaja R...
-
1- Who is the Commerce & Industry minister of India? (A). Anand Sharma (B). Kapil Sibbal (C). Salman Khurshid (D). Kamal Nath Ans:...
-
1. Which of the following pairs of countries are the signatories of a Gas pipeline deal christened as Peace Pipeline 1) Iran - Iraq 2) Ira...
-
1. Which symbol will be on the face opposite to the face with symbol * ? A. @ B. $ C. 8 D. + 2. Two positions are dice ...
-
1. A clock shows the time as 6 a.m. If the minute hand gains 2 minutes every hour, how many minutes will the clock gain by 9 p.m.? (a) 30 ...
online materials. Powered by Blogger.
Labels
Arithmetic
(8)
C Programming
(3)
current Affairs
(3)
General Awarens
(5)
JAVA Programming
(2)
Reasoning
(5)
videos
(1)
Total Pageviews
Total Posts
Calender
Feedjit
Blog Archive
-
▼
2011
(27)
-
▼
September
(11)
- JAVA Interview Questions1
- Aptitude puzzles and Arithmetic Problems
- Digital Circuits and Systems video lecture
- Programming Question & Answers in C-language:Test ...
- Programming Question & Answers in C-language:Test ...
- Analytical Reasoning
- Aptitude Questions with answers
- General Aptitude Question Answers for All Examinat...
- GENERAL AWARENESS For All Exams on GK
- Business & Marketing Aptitude Multiple choice Ques...
- Current Affairs Quiz August 2011
-
▼
September
(11)
Post a Comment