GeekInterview.com
Series: Subject: Topic:

Java OOPS Interview Questions

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

What is run time polymorpism and complie time polymmorpism

Asked By: yaduvancy | Asked On: Jan 27th, 2006

Answered by: pratibha on: May 13th, 2014

Run time polymorphism is achieved by virtual function and inheritance whereas compile time polymorphism is achieved by functions and operator overloading.

Answered by: divya mishra on: Dec 20th, 2013

Compile time polymorphism is also called method overloading, early binding and static binding . in this compiler checks the signature of methods.

In run time polymorphism its decide which function is to call. it is also called method overriding, late binding, and dynamic binding.

What is the difference between call by value, call by reference, call by address?

Asked By: bhatiagagan5 | Asked On: Oct 25th, 2007

No answers

Answered by: Milan unjiya on: Jan 2nd, 2014

Call by value---> when we pass normal variable in method, it is call by value.

Call by reference---> when we pass object as parameter, it is passed by reference.

Call by address---> call by reference and call by address both are same.

Answered by: mani_miit on: Dec 14th, 2009

Call by value--->You are passing primitive value for your method argument.call by ref--->You are passing objectcall by address-->reference and address both are same.

How is memory allocated by new ?A) in a heap b) in a stack b) both a & b c) none of these.

Asked By: lakshmi | Asked On: Jul 12th, 2006

Answered by: Pavithra on: Dec 20th, 2013

In a stack

Answered by: venkat on: Mar 7th, 2013

A) In a Heap

Floating point numbers

Asked By: mehulgala177 | Asked On: Sep 23rd, 2011

Why in C++ (0.1 + 0.1) is not equal to 0.2 ??

Answered by: moin khan on: Sep 13th, 2013

It is obviously give 0.2 answer ...

Code
  1. #include <iostream>
  2. #include<stdio.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     float a;
  9.     a=0.1+0.1;
  10.     printf("%f
  11. ",a);
  12.    cout<<a;
  13.    return 0;
  14. }
  15.  

Answered by: Sandhya.Kishan on: Mar 12th, 2012

The floating-point arithmetic in most computer languages is based on binary fractions (1/2, 1/4, 1/8, 1/16, ...) and not decimal fractions (1/10, 1/100, 1/1000, 1/1000,...)there is no ActionScript Number that is exactly equal to 0.1 because it require an infinite number of binary fractional bits.

Access the members of child class

Asked By: ashutosh060 | Asked On: Sep 15th, 2011

How is that we can make a parent class to access the members of child class?

Answered by: malik_malik on: Sep 23rd, 2012

Using polymorphism we access child class with the object of base class.

What is the situation you will need to use partial class in .Net

Asked By: gupta.vicky15 | Asked On: Oct 26th, 2011

Star Read Best Answer

Editorial / Best Answer

Answered by: Sandhya.Kishan

View all answers by Sandhya.Kishan

Member Since Mar-2012 | Answered On : Mar 12th, 2012

Visual Studio uses partial classes to separate auto-generated code from user-generated code. Example:Let us consider that visual studio creates a file called Form1.Designer.cs which holds the designer-related, auto-generated code. So in both Form1.cs and Form1.Designer.cs the Form1 class is declared as partial and the compiler joins them into one.

Answered by: malik_malik on: Sep 23rd, 2012

When different programmers work on single project and all write a code in class .Every programmer declare this class as Partial class and implement own code at the end of the day this partial class have all functionality that all programmers put in this class.

Answered by: Sandhya.Kishan on: Mar 12th, 2012

Visual Studio uses partial classes to separate auto-generated code from user-generated code. Example:Let us consider that visual studio creates a file called Form1.Designer.cs which holds the designe...

Call the method to presentation layer

Asked By: dhivyapriyab | Asked On: Jun 20th, 2012

If there is a class library called numbers and method add num.How will you call the method to presentation layer?

Answered by: malik_malik on: Sep 23rd, 2012

To call the library number you do following steps First you declare an object of that class and then using that object you call its methods. Example:

Code
  1. Number numobj=new Number();
  2. int res=numobj.ADD(5,9);

Can we provide the constructor in abstact class? If yes why? What is internal mechanism of JVM

Asked By: subbu | Asked On: Nov 19th, 2005

Answered by: akash on: Aug 10th, 2012

Any class be it abstract or not, has a default constructor created by the jvm.

Answered by: iamlegend108 on: May 2nd, 2011

Yes, abstract classes may contain constructors reason is:abstract classes may contain variables to instantiate those variables we use constructors.

What is a concrete classes? Is Java object class is concrete class?

Asked By: vishal | Asked On: Feb 20th, 2006

Answered by: raju on: Mar 22nd, 2012

Concrete class is a class with implementation for all the methods in it. Concrete class defines all the abstract methods of an abstract class which it is extending. Object class is a concrete class.

Answered by: soman on: Jul 20th, 2011

Concrete class is made up of 50% cement n 45% gravels mixed with !/2 glass of water....

Partial class

Asked By: gupta.vicky15 | Asked On: Oct 26th, 2011

Where do you use partial class ? Explain with real time scenario of the usage ?

Answered by: Sandhya.Kishan on: Mar 12th, 2012

Splitting the class into multiple files is called as partial class.The compiler treated the files as different classes but during compilation these files will be treated as a single class. Example:If...

What is the use of abstract classes? How will we decide in a scenario, whether we have to use abstract class or interface?

Asked By: Rajiv | Asked On: Nov 29th, 2005

Answered by: ram on: Feb 17th, 2012

First of all abstract is a key word. Abstract classes are having both defined methods and undefined methods. Concrete classes having only defined methods in the case of concrete classes the execution ...

Answered by: raghu on: Nov 3rd, 2011

Can any one give a real time example program for abstract class and virtual functions plzzzzzzzz

Int i;void main(){ int j=100,k; cout

Asked By: dasangampraveena | Asked On: Oct 7th, 2007

Answered by: syam on: Dec 14th, 2011

Compilation fails, why because it does not have proper syntax and structure.

Answered by: sarfraj mulani on: Sep 1st, 2010

This program gives error becoz here j=100 but the value of j is not used.

What is the output of this code?

Asked By: shrishti | Asked On: Aug 23rd, 2011

If(condition) { printf("hello"); } else { printf("world"); }

Answered by: Law Kumar on: Aug 23rd, 2011

If condition is true then "hello" will print else "world".

We are writing what it actually .I mean it is error object or else other

Asked By: Naresh | Asked On: Sep 12th, 2005

Answered by: Subhan Sun on: Jun 30th, 2011

Iserrorpage is attribute of page, While executing the page it throws any errors then it returns Exception Object 

Answered by: Sarje on: Aug 27th, 2009

If in MyErrorPage.jsp<%@ page isErroPage="true" %>is written it doesn't mean this is an Error Object.If this page is included as error page in any other jsp (suppose MyPage.jsp) us...

Why is multiple inheritance not allowed in Java?

Asked By: swati | Asked On: Sep 30th, 2005

Answered by: pallabi87 on: May 16th, 2011

This is so because it leads to a problem called "dirty diamond".that is, say class B and C inherit from class A.class B and C might override the methods in A.Now if D inherits from B and C(multiple inheritance), there would be a problem that which overridden method would it inherit

Answered by: mundravijay on: Dec 7th, 2009

Due to the naming complexity in Base & Drived classes,We Can't provide a solution  every time using Inheritance with same name of member,methods.That's why It's not allowed in JAVA.Imp: Multiple Inheritance is allowed in Java In Only the case of Interfaces.

Java super

Asked By: d.yadagiri | Asked On: Oct 15th, 2009

Is super a keyword or method? Explain why?

Answered by: usmansleem on: May 24th, 2011

This is basically used to call the constructor of the base class. It is a method of course.

Answered by: Narsi Reddy on: Apr 29th, 2011

Super is a keyword in Java because it is defined as keyword in java and super is not a keyword or variable which belongs to any class.

Can I restrict the users of my class(say class a) to create an instance of my class not more than once(only one), and if anybody tries to create more than one instance, all the object refernces should...

Asked By: waseem | Asked On: Dec 13th, 2005

Answered by: sampra on: Mar 10th, 2008

Yes it can be done by singliton class

Answered by: sarvesh bhatnagar on: Apr 12th, 2006

Preventing direct instantiationWe all know how objects are instantiated right? Maybe not everyone? Let's go through a quick refresher.Objects are instantiated by using the new keyword. The new keyword...

What types of diagrams are generally created while designing an use case / functionality ?

Asked By: sunils | Asked On: Oct 5th, 2006

Most frequently used diagrams are- class diagram- sequence diagramrarely used- component diagram- package diagramclass diagram a diagram that shows a collection of declarative (static) model elements, such as classes, types and their content and relationshipsequence describes an interaction by focusing...

Answered by: SuprajaYKM on: Mar 20th, 2007

Class   Diagram  : They describe the static structure of a system.Package Diagram  : Package diagrams organize elements of a system into related groups to minimize depend...

Friend function overload

Asked By: surendra_sahu786 | Asked On: Aug 30th, 2008

Why friend function cannot be used to overload the assignment operator?

Answered by: pavanbitsgoa on: Jan 5th, 2011

Java is actually designed to work same as C++ but avoid complex features like operator overloading, friend functions, multiple inheritence.

Answered by: kunal1903 on: Jun 17th, 2010

In Java it is not possible to overloading OPERATOR such as +/-/* etc. We can do that is C++. In Java there won't be any friend function. ...That is why we can't use friend function overloading in Java

First | Prev | | Next | Last Page

 

 

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

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.