wood burning stoves*
The moose likes Beginning Java and the fly likes .class what does it do Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark ".class what does it do" Watch ".class what does it do" New topic
Author

.class what does it do

Praveen Seluka
Ranch Hand

Joined: Jul 17, 2007
Posts: 95
Hi all

I came across this code...

LoggerFactory.getLogger(DispatcherThread.class);

Actually this method requies a String as an argument so what is this DispatcherThread.class doing there as a parameter.

I have never come across this.Any help

Thanks
Praveen SP
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Praveen Seluka:

I came across this code...

LoggerFactory.getLogger(DispatcherThread.class);

Actually this method requies a String as an argument so what is this DispatcherThread.class doing there as a parameter.


Assuming that code compiles, that's proof that there also is a getLogger method that accepts a Class object as an argument. Either the method is overloaded, or the LoggerFactory is a different class than you thought.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13875
    
  10

Every object in Java is an instance of a class, as you know. There's also a class named "Class" in the standard library, that you can use to find out information about the class of an object.

The ".class" notation is a way to get the Class object of a Java class. For example:



Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Praveen Seluka
Ranch Hand

Joined: Jul 17, 2007
Posts: 95
Hi jesper

Thanks for your information.
so in my above code
LoggerFactory.getLogger(DispatcherThread.class);

The dispatcher.class is a class object and it gets the String there from the toString method.right? Sorry that am not clear in my language

Praveen SP
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3169
    
  10
Originally posted by Praveen Seluka:
The dispatcher.class is a class object and it gets the String there from the toString method.right?


No. Read Ilja's post again.


Joanne
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: .class what does it do
 
Similar Threads
Research and Development in India
Sun Certified Enterprise Architect For J2EE Technology Study Guide
not able to access static data
ejb questions
request.getRemoteUser()