Core Java Interview Questions
Questions Answers Views Company eMail

The following program is Overloading or Overriding? public class PolymorphismEx { public int sampleMethod(int a) { return a; } public String sampleMethod(int a) { return "Is it Overloading or Overriding???"; } }

Ness Technologies, TCS,

4 6051

I Have a class abstract with one abstract method, so that method should override in the subclass, but i dont want to override, if i am not override what will happen? If compilation will occur then i dont want to give compilation error, then what we need to do??? See the sample program. public abstract class AbstractExample { public abstract void sampleMethod(); } public class AbstractExampleImple extends AbstractExample { }

Mphasis,

2 5071

is it mandatory to deaclare all variables public static fianl in interfaces?if i declare like in the below program, public interface A { public static final int I=0; int j=0; } in interface A,what is the difference between I,j?

2 3369

public class Test { public static void main(String[] args) { int countA = 0; int countB = 0; int countC = 0; int countD = 0; int countE = 0; int countF = 0; int countG = 0; int countH = 0; int countI = 0; int countJ = 0; int countK = 0; int countL = 0; int countM = 0; int countN = 0; int countO = 0; int countP = 0; int countQ = 0; int countR = 0; int countS = 0; int countT = 0; int countU = 0; int countV = 0; int countW = 0; int countX = 0; int countY = 0; int countZ = 0; } } Can anybody tell me any alternate solution(like loop or something) to automate this initialization process. Ex:- for(char chr='A';chr<='Z'; chr++) { (int) String "count"+chr = 0; }

1841

what is different between static and non static methods ,using example

2 3207

Which collection object is faster to retrieving the data and inserting the data into it.

Jamcracker, Virtusa,

2 7307

what is the difference b/w static and final methods?

1 3787

what is data binding? give the example

TCS,

1 4131

what is deadlock in threads? with example

CTS, XOXO,

2 4663

Difference between abtsract & final

Nous,

1 3235

Difference between error and exception

Nous, TCS,

3 4995

Superclass of exception

Nous,

4 5177

Write POJO class as a key to hashmap???

2 11815

WAP to illustrate the use of interface

2 3259

Difference between Map & Hashmap

Mastek,

2 5415


Post New Core Java Questions

Un-Answered Questions { Core Java }

Can a constructor call another constructor?

556


Print Vertical traversal of a Binary Tree.

599


How many JVMs can run on a single machine and what is the meaning of Just-In-Time (JIT) compiler?

748


is there a separate stack for each thread in java? : Java thread

529


What is public static?

487






What is a protected method?

589


What are daemon Threads in java?

604


Explain access specifiers?

649


Is an empty arraylist null?

587


Explain the protected field modifier?

587


What are peerless components?

611


What are different types of multitasking?

536


How do you download stubs from Remote place?

1350


What is the difference between math floor and math round?

489


What is constructor in java ?

627