Series: Subject: Topic:

Core Java Interview Questions

Showing Questions 1 - 20 of 577 Questions
First | Prev | | Next | Last Page
Sort by: 

Why Java does not support multiple inheritance?Why Java is not pure object oriented?

Asked By: vas | Asked On: Sep 18th, 2005

Answered by: pratima on: Oct 15th, 2014

If Java supports multiple inheritance then compiler will get confuse which override method will called,because it may be case same methods are using in different different classes . {geshibot langua...

Answered by: M.Rajeev on: Aug 27th, 2014

Java does not support multiple inheritance,reason is where the sub class having many number of super classes.
java applications are purely object oriented because of some primitive data types java language is not considered purely object oriented to over come the difficulty by using wraps classes.

What is the difference between a callablestatement and preparedstatement?

Asked By: Swati | Asked On: Dec 29th, 2005

Answered by: pratima on: Oct 15th, 2014

Prepared statement:Use when you plan to use the SQL statements many times. The Prepared Statement interface accepts input parameters at run time.

CallableStatement:Use when you want to access database stored procedures. The Callable Statement interface can also accept run time input parameters.

Answered by: Anang Desai on: Aug 13th, 2014

First of all let me tell about Statement (Interface) this interface is used to execute the SQL query in the programme, Prepare Satement(Interface) Extends Statement Interface and it is also used to Ex...

Is Java a fully object oriented programming or not? If not why?

Asked By: Beena | Asked On: Sep 16th, 2005

Star Read Best Answer

Editorial / Best Answer

Answered by: KanikaKG

View all answers by KanikaKG

Member Since Jul-2008 | Answered On : Aug 3rd, 2008

No. Java is not 100 % Pure OOP because of following three reasons:
1) It doesnot support Multiple inheritance.
2) It allows use of primitive data types which are not an objects.
3) It allows static methods to call without creating the instance.

This disobeys OOPs concepts 
Java isnt 100% pure OOPS coz if it were then everything should be classes and objects, whereas java still has primitive data type which violates the above said statement...SmallTalk is the only 100% pure OOPS language

Answered by: suresh on: Aug 5th, 2014

Actually you are said that java cant create objects for integer,float....
but according to autoboxing concept we can create object for that value

Integer i=new Integer(1000); //autoboxing
we can use this reference to get "i" value...

Answered by: sivapurammani on: Jul 8th, 2013

Java is not a fully Object Oriented Language because in OOB all the things should be done by Object only but in JAVA we are failing to do that(To be frank intentionally they did that)......For example...

Generating ppt through Java

Asked By: dinshetty | Asked On: Jul 11th, 2008

I am trying to generate ppt through Java using apache poi API. I am able to create table, bulleted text etc using this API. Please answer the following two questions, if anyone is aware of this. 1. How to split text across two slides, if the row had to be broken across 2 slides because the row is...

Answered by: ashishthakran on: Jul 28th, 2014

A list of few more Java interview questions like

1. By default, Java is pass by reference or pass by value. How does it handle?

2. In which scenario, you will use custom exceptions in Java.

3. How does garbage collection work in Java

Answered by: Omen on: Nov 8th, 2013

Try this Java Library, i hope it will solve your problem:

Why map is not include in collection in Java?

Asked By: manoj.arah | Asked On: Aug 20th, 2013

Means, map is a pert of collection framework but not included in collection....Only list, set and queue are included ....Why?

Answered by: siddhi parkar on: Jul 1st, 2014

Map in an either interface or class it only stores or maps key to the object.although its not a collection its fully integrated with collection in terms of collection-view of map.

What is mvc architecture

Asked By: Interview Candidate | Asked On: Sep 7th, 2005

Star Read Best Answer

Editorial / Best Answer

Answered by: Mitchel K

Answered On : Jun 27th, 2005

A design pattern describes a proven solution to a recurring design problem, placing particular emphasis on the context and forces surrounding the problem, and the consequences and impact of the solution.  
There are many good reasons to use design patterns. Here are three: 
1) They are proven. You tap the experience, knowledge and insights of developers who have used these patterns successfully in their own work. 
2) They are reusable. When a problem recurs, you don't have to invent a new solution; you follow the pattern and adapt it as necessary. 
3) They are expressive. Design patterns provide a common vocabulary of solutions, which you can use to express larger solutions succinctly. 
The goal of the MVC design pattern is to separate the application object (model) from the way it is represented to the user (view) from the way in which the user controls it (controller).  
The MVC architecture has the following benefits: 
1) Multiple views using the same model: The separation of model and view allows multiple views to use the same enterprise model. Consequently, an enterprise application's model components are easier to implement, test, and maintain, since all access to the model goes through these components. 
2) Easier support for new types of clients: To support a new type of client, you simply write a view and controller for it and wire them into the existing enterprise model. 
3) Clarity of design: By glancing at the model's public method list, it should be easy to understand how to control the model's behavior. When designing the application, this trait makes the entire program easier to implement and maintain. 
4) Efficient modularity: of the design allows any of the components to be swapped in and out as the user or programmer desires - even the model! Changes to one aspect of the program aren't coupled to other aspects, eliminating many nasty debugging situations. Also, development of the various components can progress in parallel, once the interface between the components is clearly defined.  
5) Ease of growth: Controllers and views can grow as the model grows; and older versions of the views and controllers can still be used as long as a common interface is maintained.  
6) Distributable: With a couple of proxies one can easily distribute any MVC application by only altering the startup method of the application.

Answered by: Anil Nivargi on: Jun 26th, 2014

The MVC consists of three kinds of Objects i.e Model,View and Controller. Lets start explaining one by one. 1) Model- It handles data processing and database works part. Model processes event...

Answered by: dhilip88 on: Nov 23rd, 2010

Mvc architecture says that in an event that contains buttons, textboxs and panels or checkboxs..... the operation that changes this state is mvc-> clearly m-->model say button., view-->button...

What is neutral data? How it is related to Java ?

Asked By: enjoy | Asked On: Mar 20th, 2007

Answered by: pavan on: Jun 23rd, 2014

Example:- In c language windows 16-bit "c void main() { int a; printf(size of(x)); } o/p:- 2 byte windows 32-bit void main() { int a; ...

Threading : - how can you pass data between two threads?

Asked By: changaez | Asked On: Dec 2nd, 2005

Answered by: Adham on: Jun 12th, 2014

Passing variables through global variable can result in unexpected problems as many threads may try to modify this variable at the same time.
Programing languages provide different ways to deal with this problem
as delegates and invocation, pipes, handlers and loppers.

Answered by: amit saini on: Jan 8th, 2007

Java simplifies I/O by providing a rich library of classesthat support stream interfaces. Among these classes, the combination ofPipedInputStream and PipedOutputtStream closely resembles a UNIX system...

How many ways we can create object ?

Asked By: kishore | Asked On: Nov 8th, 2006

Answered by: Ashish on: Jun 12th, 2014

There are 7 ways to create object... 1 Using : new keyword 2 Using : Static Factory 3 Using : Instance Factory 4 Using : Factory Pattern 5 Using : De-serialization 6 Using : Clone Method 7 Using : new...

Answered by: chandrasekhar rao naidu on: Feb 8th, 2013

3 ways

1. new Operator,
2.object class clone() method
these are main.
and another ways also there
1.class.forName()---------> this method internally uses the newInstance method,
2.Deserialization-----> this is also internally use the above 3 ways

What is the difference between static and final?

Asked By: Gaurav Sharma | Asked On: Oct 25th, 2006

Answered by: dharani on: Jun 3rd, 2014

Static variable is a global variable shared by all the instances of objects and it has only single copy.Final variable is a constant variable and it cant be changed.

Answered by: venkata on: Mar 18th, 2013

Static: Attributes whose value remains same throughout all its instances , But can be changed by Any instance Final: Attributes whose values remains same throughout every Specific instance of the clas...

Output of Java program

Asked By: khadarzone | Asked On: Apr 11th, 2008

What is the output of the following program?Class a{ public static void main(string[] s) { system.Out.Println(s[1] + s[2] + s[3]);}}Java a 12345options(i) 1(ii) 12(iii)1234(iv)234(v) compilation error

Star Read Best Answer

Editorial / Best Answer

Answered by: abuthahir.d

View all answers by abuthahir.d

Member Since Jan-2008 | Answered On : Apr 14th, 2008

Khadar , i tried this code . it gives that exception

for the foll reason : 
 when u give a CLA(command line argument) , it will be inserted in the index 0 of the array and then will proceed to 1 ,2 ....

so as per the question , "12345" will be at s[0] . and length of that aray will be 1when u try to access s[1] , we are trying for 2nd element which is unavailable..... 

Hope this answers u  :-)

Answered by: Poorna on: May 30th, 2014

Compile time error :ArrayIndexOutOfBoundsException

Answered by: Aneesh on: Oct 11th, 2013

S[1]+s[2]+s[3]=>s[0]+s[1]+s[2] javac java A 1 2 3 123

  1. class A{
  3.     public static void main(String[] s) {
  4.         System.out.println(s[0] + s[1] + s[2] ); // 3 args
  6.        // System.out.println(s[3]);
  7.     }
  8. }

What is the use of interface in realtime Java project ?

Asked By: Raman KD | Asked On: Sep 16th, 2013

Answered by: ashokvenna on: May 28th, 2014

Using Interface ,we can easily share the Data between applications,bcause interface has by default public and abstract methods,so any body can implement that methods must and should.And Interface supp...

Answered by: prabhu.S.R on: Feb 16th, 2014

To import many subclasses.

Guess the output of the following program

Asked By: pardeep131085 | Asked On: Nov 29th, 2013

Try to guess without running the program.

  1. public class IntegerClassExampleThree {
  2.  public static void main(String[] javalatte) {
  3.   Integer i = 400;
  4.   Integer j = 400;
  5.   if(i==j){
  6.    System.out.println("i==j is equal");
  7.   }else {
  8.    System.out.println("i==j is not equal");
  9.   }
  10.  }
  12. }
  13. public class IntegerClassExampleFour {
  14.  public static void main(String[] javalatte) {
  15.   Integer i = 127;
  16.   Integer j = 127;
  17.   if(i==j){
  18.    System.out.println("i==j is equal");
  19.   }else {
  20.    System.out.println("i==j is not equal");
  21.   }
  22.  }
  24. }

Answered by: mani on: May 28th, 2014

Int value ends at 127 so upto 127 the hash code for int value is same.the answer is not equal and equal

Answered by: onkar on: Dec 28th, 2013

1. First of all in one java file you can not have two public classes. 2. Second you will have to run a particular public class "java classname" and then its main method would run. Note - If there i...

Determining the order of threads

Asked By: Sumantra_07 | Asked On: Jun 27th, 2012

Q.--" I created five(5) thread instances,say "1","2","3","4","5" and start all of them at the same time,one after the other. The priorities for the threads are same.What should be done so that the threads run concurrently in the same order,i.E1,2,3,4,5(is there any way at all)"?

Answered by: Vijay on: Jan 10th, 2014

We can do that by using the join. In the second thread run method, we can call the join on first thread object. In the third thread run method, we can call the join on second thread object. Like this ...

Answered by: mduhan on: Apr 8th, 2013

We have to implement run method to create a thread.We need to make that method synchronized so that only one thread can go inside and control will be given to second only and only of first is completed.

Synchronization in Java

Asked By: sathyasha | Asked On: May 30th, 2008

When we should use synchronization in Java and when we should not?

Answered by: sivapurammani on: Dec 16th, 2013

In simple terms we can say only one thread can act on selected resource(method or variable). Understanding the above sentence is as follows:: For example we are booking any ticket in a particular bu...

Answered by: Yeswanth on: Dec 6th, 2013

If you want to allow only one thread at a time to access block of code or method then we will go for synchronization.

  1. public synchronized
  2. void singleProcess() {
  3. // Insert code here
  4. }

Why we are using OOPS?

Asked By: narendra_d | Asked On: Oct 27th, 2011

Answered by: sivapurammani on: Dec 16th, 2013

Before introducing OOPS some other concepts are also introduced into the computer world, for example Procedure Oriented Language(The best example for this is C language) but these concepts are working...

Answered by: mukesh jha on: Aug 8th, 2013

OOPS  stands for object oriented programming . They are   1. Abstraction 2. Encapsulation 3. Inheritance 4. Polymorphism Abstraction is representation of  some property without giving backgroun...

What is the difference between abstract class & final class

Asked By: abhipsa | Asked On: Sep 30th, 2006

Answered by: sivapurammani on: Dec 3rd, 2013

If any class is declared as final class then other classes cannot able to interact with the final class i.e it is not possible to use the variables as well as methods of final class. But if we declar...

Answered by: naveen on: Nov 25th, 2013

Abstract class contains Abstract methods and normal methods. Where Abstract methods do not have any body. The implementation of abstract methods will be in their sub class.

Final class is a class where we cannot create any subclass to the final class.

What is throwable and where should we use this?

Asked By: veera | Asked On: Dec 20th, 2006

Answered by: mukesh on: Oct 21st, 2013

In the Try Block
Caught in Throwable class

Answered by: santh kumar on: Dec 20th, 2006

" Throwable " is a class(it's default super class is Object) in java API. The Throwable class is the superclass of all errors and exceptions in the Java language. Only objects that are instances of ...

Can array with zero length exist in Java?

Asked By: KanchanT | Asked On: Jul 15th, 2006

Answered by: swapnil on: Sep 17th, 2013

Yes, array size in java is always 0 bz array is start with 0th location

Answered by: sujatham on: Aug 10th, 2007

Yes.Array can have zero length in java.

First | Prev | | Next | Last Page





twitter fb Linkedin GPlus RSS


Interview Question

 Ask Interview Question?


Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.