Core Java Interview Questions
Questions Answers Views Company eMail

Can we declare Pointer in Java?

5 587

What is the default value stored in Local Variables?

5 581

Difference in the use of print, println, and printf.

5 518

Is it possible to make an array volatile?

4 592

What is an object-oriented paradigm?

5 577

What are the Memory Allocations available in JavaJava?

1 363

What is a singleton class in Java? And How to implement a singleton class?

2 395

Can you explain the Java thread lifecycle?

1 415

In the below Java Program, how many objects are eligible for garbage collection?

1 454

What is JDK? Mention the variants of JDK?

1 355

What are Brief Access Specifiers and Types of Access Specifiers?

1 369

Explain Method Overloading in Java.

1 397

Give a briefing on the life cycle of a thread.

1 369

Brief the life cycle of an applet.

1 295

What are the observer and observable classes?

1 481


Post New Core Java Questions

Un-Answered Questions { Core Java }

What is a for loop in java?

820


Is main a keyword in java?

743


What is wrapper class example?

738


What do you understand by abstract classes?

827


when to use ArrayList and when to use HashMap in webApplication.

4235


When can we say that threads are not lightweight process in java?

826


Can there be an abstract method without an abstract class?

726


3.2 Consider the following class: public class Point { protected int x, y; public Point(int xx, int yy) { x = xx; y = yy; } public Point() { this(0, 0); } public int getx() { return x; } public int gety() { return y; } public String toString() { return "("+x+", "+y+")"; } } Say you wanted to define a rectangle class that stored its top left corner and its height and width as fields. 3.2.1 Why would it be wrong to make Rectangle inherit from Point (where in fact it would inherit the x and y coordinates for its top left corner and you could just add the height and width as additional fields)? (1) 8 Now consider the following skeleton of the Rectangle class: public class Rectangle { private Point topLeft; private int height, width; public Rectangle(Point tl, int h, int w) { topLeft = tl; height = h; width = w; } public Rectangle() { this(new Point(), 0, 0); } // methods come here } 3.2.2 Explain the no-argument constructor of the Rectangle class given above. 3.2.3 Write methods for the Rectangle class to do the following: • a toString() method that returns a string of the format "top left = (x, y); height = h; width = w " where x, y, h and w are the appropriate integer values. • an above() method that tests whether one rectangle is completely above another (i.e. all y values of the one rectangle are greater than all y values of the other). For example, with the following declarations Rectangle r1 = new Rectangle(); Rectangle r2 = new Rectangle(new Point(2,2), 1, 4); the expression r2.above(r1) should give true, and r2.above (r2) should give false. (You can assume that the height of a rectangle is never negative.) (2) (5)

2706


What are some characteristics of interference class?

756


Can inner class have constructor?

747


What is local declaration?

702


Describe the process as to how substring() methodology mechanisms in java.

785


What is the difference between inheritance and encapsulation?

849


How many bytes is a string?

831


What is a parameter in java?

734