• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why is the class loading method called "forName"?  RSS feed

 
Dan Howard
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does "for name" mean? It doesn't even seem like proper English. It should be called "load" or "loadClass" no?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Makes perfect sense to me as the parameter is the class name.

So it can be read as "load class for name com.xyz.Whatever".
 
Dan Howard
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Makes perfect sense to me as the parameter is the class name.

So it can be read as "load class for name com.xyz.Whatever".


Yeah but it's saying class.forName so it's more like Class: For Name "com.xyz.Whatever" which sounds weird to me.

Then of course you have ClassLoader.loadClass which makes more sense.... So we could have had Class.loadClass instead...

Anyway, it's always bugged me a bit. ;)
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I actually kinda like it.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!