Interviewer: Is it possible to print some statement to the console without using main()? If it is yes...How?
Interviewee: Yes sir,...As follows
class SCJP
{ static
{ System.out.println("SCJP-FAQ");
System.exit(0);
} }
Interviewer: Fine. Then Is it possible to print some statement to the console without using main() and a static block?
Interviewee: Yes sir, No problem at all...As follows
class SCWCD
{ static int i=m1();
public static int m1()
{ System.out.println("SCWCD-FAQ");
System.exit(0);
return 10;
} }
Contact Admin for Dumps and Queries
How to print some statement to the console without using main()::::Google Interview Question----FAQ
Java---Points to Remember
A java Source file can contain any number of public classes but utmost one class can be declared as "public".
What is the difference between Interface and Abstract class ?
Lets first analyze the definitions of Interface and Abstract class then we will proceed to the differences.
Interface
In general, from client point of view Interface is the set of services what he is getting.
And from service provider point of view, it is the set of services what he is offering.
A Java interface defines a set of methods but does not implement them. A class that implements the interface agrees to implement all of the methods defined in the interface, thereby agreeing to certain behavior.
Definition: An interface is a named collection of method definitions (without implementations). An interface can also include constant declarations.
Abstract Class
An abstract class is a type of class that is not allowed to be instantiated. The only reason it exists is to be extended. Abstract classes contain methods and variables common to all the subclasses, but the abstract class itself is of a type that will not be used directly. Even a single abstract method requires that a class be marked abstract
The Main Difference Between the Abstract Class And the Interface are:
1)When inheriting an Interface, we have to inherit all the methods of that Interface.. there's no other option. Where as with abstract classes we can inherit the members that we are in need of.
2) An Interface cannot have any declaration within it. Just the interface has to have body of the method and the method is to be used by the classes inheriting it. Whereas in case of Abstract Class it can have declarations (Other than the abstract method) and it can be further extended in the classes inheriting the Abstract Class.
How is the SCJP 1.6 exam different from the SCJP 1.5?
There exists some considerable differences between SCJP 1.5 and SCJP 1.6. Lets have a look at those >>>
* Exam objectives: Several new API classes/interfaces have been added: java.io.Console, java.util.NavigableSet, java.util.NavigableMap. Explicit garbage collector calls (i.e. System.gc()) will no longer be tested, but candidates will still be expected to understand garbage collection and the finalize() method. Also, the following topics will be tested in greater depth: exception handling, collections, assertions, threads, and flow control. See the SCJP forum for more details.
* Number of questions: 72 (no change)
* Time: 210 minutes (increased from 175 minutes)
* Passing score: 65% (increased from 59%)
* Format of questions: No change.
Sun Certified Java Programmer (SCJP) Syllabus
SCJP EXAM OBJECTIVES
Language Fundamentals
Operators and Assignments
Declaration and Access Control
Flow Control
Exception Handling
Assertions
OO Concepts
Threads and Concurrency
Fundamental classes in java.lang package
Object Class
String Class
StringBuffer Class
StringBuilder Class
Wrapper Classes
Math Class
The Collections Frame Work and Generics
File I/O & Serialization
Garbage Collection
- 1.5 New Features
Enum
For-Each Loop
Var-Arg Methods
Auto Boxing & Un Boxing
Static Imports