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 6006

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 5038

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 3346

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; }

1826

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

2 3175

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

Jamcracker, Virtusa,

2 7281

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

1 3756

what is data binding? give the example

TCS,

1 4112

what is deadlock in threads? with example

CTS, XOXO,

2 4647

Difference between abtsract & final

Nous,

1 3216

Difference between error and exception

Nous, TCS,

3 4961

Superclass of exception

Nous,

4 5148

Write POJO class as a key to hashmap???

2 11785

WAP to illustrate the use of interface

2 3239

Difference between Map & Hashmap

Mastek,

2 5395


Post New Core Java Questions

Un-Answered Questions { Core Java }

How can you add and remove nodes in jtree?

593


Can you declare an interface method static?

559


What is the difference between a vector & an array list?

646


Explain about fail safe iterators in java?

543


Is java free for commercial?

474






Why super is first line in java?

533


What are the common uses of "this" keyword in java ?

553


What is the difference between assignment and initialization?

531


Is it possible to specify multiple jndi names when deploying an ejb?

536


What are java packages? What is the significance of packages?

544


How many types of design patterns are there?

509


Which collections are thread safe in java?

455


What are the different types of inheritance in java?

503


When do we use synchronized blocks and advantages of using synchronized blocks?

642


Why is java architectural neutral?

597