• 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

Want to know about Singleton Class

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello guys,
can any one explain me what is SingleTon class and what is the use of it with detailed example
my another question is when we should use Thread Class and when we should use Runnable Interface(eventhough Thread and Runnable both are used to create our own Thread)
then which one is the best option that we should go for.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
*It is better to google first for the detail*. if you have any specific doubt about the detail, then please post the doubt.
 
Ranch Hand
Posts: 394
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IMHO I agree with Seetharaman...You should make some effort first, make some research either in google or in this forum by using the search dialog box, place the codes here and tell us what you dont understand. Asking for help 'from-the-scratch' is NOT the best way to learn.

With reference to threads you should at LEAST tell us which one you think is better and why, then we will analyse together.

Regards

Ikpefua
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also please UseOneThreadPerQuestion
For both of these questions, as pointed out by others, can be found in lots of previous posts.
 
Ranch Hand
Posts: 300
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have shared some of my experience around singleton and Runnable and Thread class in my blog post, check it out you may get some idea around them.

10 questions on Singleton pattern in Java

how to implement thread using Thread class and Runnable interface
 
sharma sachin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

hello guys
here is the above code now the output is not cleared to me.
the first println says:class MyReflection and second println statement says MyReflection
if we know the class name at compile time then we can get the java.lang.Class object written in 1 statement
if we don't know the class name at compile time but have a class name as a string at run time we can get Class object written in 2 statement
the above two statements are not cleared to me.......
can anyone take me out from my query
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic