Second Round
Q)Two interfaces have same method declaration. Both the interfaces are implemented by class.. which of the two method will be overridden?
Q)Find output of:
try{ int x=5/0;}
catch(Exception e){
System.out.println("Exception");}
catch (ArithmeticException ae) {
System.out.println("ArithmeticException occured!");
}
Q)signature of a function vs method declaration
Q)Will the code perform overloading?
class A{
public void print(){
System.out.println("Void Print");
}
public int print(){
System.out.println("Integer Print");
return 8;
}
}
Q)Will the code perform overriding?
class A{
public void print(){
System.out.println("Void Print");
}
}
class B extends A{
public int print(){
System.out.println("Integer Print");
return 8;
}
}
Q) what are the OOPS concept that can seen in the following code(blank/empty class)?
class A{}
Q) Check whether a number is odd or even without arithmetic operator.
Hint: Typecast to string. Check last digit
Q) Default access specifiers of class methods and variables
Q)Real time example of abstraction, encapsulation, inheritance, data hiding. Example class abstract phone with child class mobile and landline. Write properties and methods.
Q) Class A { public void method1(){} }
Class B extends B { public void method2(){} }
which is possible?
A obj=new B(); or B obj=new A();
Q) Which of the following datatypes are mutable and how and why? string, int, float, double, char
Q) Can a interface extend more than 1 interface?
Q) Can a class implement more than 1 interface?
Q) WAP
input: aaa1bbb2ccccc3
ouput: aabcc
Q) which operator is overloaded in java?
Q) java advanatages over c/c++?
Q) Name diifferent ways to create objects in java
Q) find common objects in list {1,{1,2},{1,2,3}}
Next Level of Coding Interview
Q) WAP to input Username & Password of user. Check whether is username and authenticated; if not the increment the counter by 1. Maximum three chances are allowed for the same IP address request. If counter is equal to 3, block all the requests from the IP Address