Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is static binding and where it occurs?

Answers were Sorted based on User's Feedback



What is static binding and where it occurs?..

Answer / ravikiran(aptech mumbai)

static binding will takes place at compile time,and it's
known as compile time binding.variables will undergo static
binding

Is This Answer Correct ?    11 Yes 0 No

What is static binding and where it occurs?..

Answer / guest

it occurs in operator overloading

Is This Answer Correct ?    5 Yes 4 No

What is static binding and where it occurs?..

Answer / yogesh mudgil

If the compiler can resolve the binding at the compile time
only then such a binding is called Static Binding or Early
Binding. All the instance method calls are always resolved
at runtime, but all the static method calls are resolved at
compile time itself and hence we have static binding for
static method calls. Because static methods are class
methods and hence they can be accessed using the class name
itself (in fact they are encourgaed to be used using their
corresponding class names only and not by using the object
references) and therefore access to them is required to be
resolved during compile time only using the compile time
type information. That's the reason why static methods can
not actually be overriden.
Similarly, access to all the member variables in Java
follows static binding as Java doesn't support (in fact, it
discourages) polymorphic behavior of member variables. For
example:-

class SuperClass{
...
public String someVariable = "Some Variable in SuperClass";
...
}

class SubClass extends SuperClass{
...
public String someVariable = "Some Variable in SubClass";
...
}
...
...

SuperClass superClass1 = new SuperClass();
SuperClass superClass2 = new SubClass();

System.out.println(superClass1.someVariable);
System.out.println(superClass2.someVariable);
...

Output:-
Some Variable in SuperClass
Some Variable in SuperClass

We can observe that in both the cases, the member variable
is resolved based on the declared type of the object
reference only, which the compiler is capable of finding as
early as at the compile time only and hence a static
binding in this case. Another example of static binding is
that of 'private' methods as they are never inherited and
the compile can resolve calls to any private method at
compile time only.

Is This Answer Correct ?    4 Yes 3 No

What is static binding and where it occurs?..

Answer / siva

static binding will takes place at compile time,and it's
known as compile time binding.

Static binding is done by the compiler

When it can determine the type of an object

Method calls are bound to their implementation immediately

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Core Java Interview Questions

Can you inherit from an abstract class java?

0 Answers  


Can you override private or static method in java?

0 Answers  


What is a lambda expression ? What's its use ?

0 Answers  


Write a program to check for a prime number in java?

0 Answers   Cyient,


How do you start a thread?

0 Answers  


What is the concatenation operator in java?

0 Answers   Aspire, Infogain,


What is the difference between Java and C++?

0 Answers   Integreon, TCS, ZS Associates,


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 Answers  


Which collection is ordered in java?

0 Answers  


What is application system?

0 Answers  


How is it possible for two string objects with identical values not to be equal under the == operator?

0 Answers  


What is the use of string and stringbuffer?

0 Answers  


Categories