• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Whats is Late Binding

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Frnds,
What is late binding?
And also whats is daemon thread?
thanx
 
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
To answer daemon thread..i would say:
it's a background thread--subordinate to the thread that creates it,
so when the thread that created the daemon thread ends, the daemon
thread dies too.
Hope that helps..
regards
NM
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These aren't the old Javaranch times, now one even cares to politely thank for one's efforts.....Uhhh global changes don't you see these things everwhere, especially in countries like India or Pakistan.Isnt that true oh resident of one of them?

Anyway I am short of time and back to your question:
Late Binding;
consider the following code:
Interface I{}
class Parent{}
class Child extends Parent implements I{}
class Test{
public static void main(String[] args){
Parent p = new Child();
I i = (I)p; //to consider
}
}
Now when you narrow cast p into i, the compiler at compile time has no assurities that p itself implements i, it compiles ok because thinks its possible that any child of p would, ofcourse in our case it is child which implements so its fine at runtime. But the core issue is that if the compiler was not sure of the p implementing i how it could compile a byte code which contained the implemented versions of I. Well the compiler does'nt it compiles the class into byte code such that the if the p does contain a child which implemented I it will be dynamically binded, hence binding of objects and their methods at runtime is called Late Binding. Even without this non-trival example, above:you should know that java deals with instance classes and methods in nearly every case dynamically through this very late binding..... Therefore all inheritence, polymorphism, object creation, remote object loading etc.. all depend on Late Binding a.k.a. Dynamic Binding.....

Daemon Threads:
Our good buddy, another ranchhand, has already put his word down for us, what I can add is that the JVM does not care for Daemon threads if they are the only ones running and no user thread are alive, in that case it simply exits.
Daemon thread are servant threads and only daemon threads can create Daemon threads and Daemon threads are always grouped in Daemon thread group(s).
However if you want to create a Daemon thread just call t1.setDaemon(true) before you execute t1.start() in you code....
Hope this helps..
Happy Ramadan, Or happy fasting month if you perfer.......
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic