-
-
-
}
}
public class test1 extends test
{
public void say()
{
super.hello();
hello();
}
public void main(String arg[])
{
test1 t = new test1();
t.say();
}
}
In the above code what will be difference of super.hello(); and hello();. What is use of super instead of calling directly method name.
">Public class test{ public void hello() { System.out.println("Helllo"); }}public class test1 extends test{ public void say(){ super.hello(); hello();}public void main(String arg[]){ test1 t = new test1(); t.say();}}In the above code what will be difference of super.hello(); and hello();. What is use of super instead of calling directly method name.
-
-
-
-
-
Run Time Exceptions
What do exception mean in java ? what type of run time exceptions?
-
Nested and Inner Classes
What is the need of nested and inner classes in Java? Explain where they are useful?
-
Which of the following options can be inserted at the commented line to compile the given code:
cpublic class Class1 {
Class1(String s){ }
Class1() { }
}
class Class2 extends Class1{
Class2(){ }
Class2(String s) {super(s);}
void m1() {
// insert code here
}
}
a) Class1 c1 = new Class1("HCL"){ }
b) Class1 c1 = new Class2(){ };
c) Class2 c3 = new Class1(String s){};
d) Class1 c1 = new Class1(100){ }; -
Print Only Numbers From Java Strings
I have a question in Java-string,
String s="adf5hgjyu1frdsff6vgyu7bnjh9asd3"; like
How to print only numbers in that string -
What is the difference between preemptive scheduling and time slicing
Under preemptive scheduling, the highest priority task executes until it enters the waitingor dead states or a higher priority task comes into existence. Under time slicing, a taskexecutes for a predefined slice of time and then reenters the pool of ready tasks. Thescheduler then determines which task should execute next, based on priority andother factors.
-
What is the purpose of the finally clause of a try-catch-finally statement
The finally clause is used to provide the capability to execute code no matter whether ornot an exception is thrown or caught.
-
What must a class do to implement an interface
It must provide all of the methods in the interface and identify the interface in itsimplements clause.
-
What happens if a try-catch-finally statement does not have a catch clause to handlean exception that is thrown within the body of the try statement
The exception propagates up to the next higher level try-catch statement (if any) orresults in the program's termination.
-
-
-
-
-
Java Interview Questions
Ans