• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Package name part of a class?

 
Viralraj Upadhyay
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read this somewhere "Package name is part of the class and cannot be modified except by recompiling the class." I did not get this clearly. Can anybody throw light on this?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

Hmmm; that seems pretty clear to me. If you have a class like



and you compile it, the package name "com.foo.you" is included in the Foo.class file. Moving the Foo.class file to a different directory doesn't change the fact that class Foo is in package com.foo.you . The only way to change that is to edit the "package" statement in Foo.java and recompile it.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic