Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

driver manager

 
ravindra patil
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
having top level class is meaningless but in jdbc DriverManager is static class so why this is sattic

t

[edited to use a meaningful subject line - was "how is this"]
[ October 18, 2006: Message edited by: Jeanne Boyarsky ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ravindra patil:
having top level class is meaningless

Why is it meaningless?


but in jdbc DriverManager is static class so why this is sattic

It is static so you can call it without having to create an object.
 
ravindra patil
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ravindra patil:
having top level class is meaningless but in jdbc DriverManager is static class so why this is sattic

t

[edited to use a meaningful subject line - was "how is this"]

[ October 18, 2006: Message edited by: Jeanne Boyarsky ]




oh......jeanne you don't require class object if class's method is static if your method is static then though your class is static you want object of it ,if you really know the answer then give it otherwise don't
what is the perpose behind having it as a static
most of the java book mention that having top leval class is meaningless
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you really know the answer then give it otherwise don't


Ravindra, everyone here tries to help others voluntarily. Please be nice to everyone, whenever you are posting in the forums.

Also, what Jeanne has mentioned in her answer is correct. We dont see anything wrong in what she has mentioned.

[Jaikiran: Edited message, since there was a mistake in addressing Jeanne]
[ October 19, 2006: Message edited by: Jaikiran Pai ]
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
most of the java book mention that having top leval class is meaningless


I havent read this before. Any reference?
 
ravindra patil
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ravindra patil:
[QB]having top level class is meaningless but in jdbc DriverManager is static class so why this is sattic



[edited to use a meaningful subject line - was "how is this"]

Mr Pai
just visit this Url
http://www.javaworld.com/javaworld/javaqa/1999-08/01-qa-static2.html t

then give me comment
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the link that you mentioned:

A top-level class is by definition already top-level, so there is no point in declaring it static; it is an error to do so. The compiler will detect and report this error.


And here's the javadoc of DriverManager:

DriverManager

Where did you find that the DriverManager class itself is declared as static? Only the methods of that class have been declared as static.
 
ravindra patil
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ravindra patil:
having top level class is meaningless but in jdbc DriverManager is static class so why this is sattic

t

[edited to use a meaningful subject line - was "how is this"]

[ October 18, 2006: Message edited by: Jeanne Boyarsky ]


man, just read JDBC section of Professional java server progreamming 1.3 edition by wrox publication and 'read it carefully'

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From your link, "Each top-level class corresponds to its own java file sporting the same name as the class name.". This is the most common type of class. It is certainly not meaningless. The link goes on to say "A top-level class is by definition already top-level, so there is no point in declaring it static; it is an error to do so." I think this is what we are discussing.

The DriverManager class follows a pattern called a "utility class." This is where all the methods are static.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jaikiran: Just want to mention that I am female.

Ravindra:
if you really know the answer then give it otherwise don't

Sometimes people (especially the moderators here) ask questions to help you elaborate your question. The alternative is everyone remaining silent because they don't understand the question and then you don't get any help.

Note that the rolleyes icon is often construed as being upset with someone. That's probably not what you wanted to portray in a technical forum. Just mentioning this so you are away of the perception of this icon. (Smilies are disabled in this forum anyway, so you may want to ease up on their use here.)
 
ravindra patil
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ravindra patil:
having top level class is meaningless but in jdbc DriverManager is static class so why this is sattic

t

[edited to use a meaningful subject line - was "how is this"]

[ October 18, 2006: Message edited by: Jeanne Boyarsky ]



Jeanne i am sorry




from where are you i ask this question because interviewer asked me that question i answered top less class is never static but when i was reading professional java server programmming 1.3 edition by wrox publication it is clearly nentioned that DriverManager is staic class but document on static on java world shows that having top level class as static is error and compiler gives error

 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeanne Boyarsky:
Jaikiran: Just want to mention that I am female.



Sorry Jeanne, i was unaware.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
professional java server programmming 1.3 edition by wrox publication it is clearly nentioned that DriverManager is staic class

Ravindra: Sometimes people/books make mistakes or are misleading. Since you are finding web articles and people (in this forum) who are stating top level classes cannot be static, I think the book meant that DriverManager contains static methods, not that it is a static class.

Jaikiran: It's not big deal. I just wanted to mention it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic