• Post Reply Bookmark Topic Watch Topic
  • New Topic

Renaming a class file (how-to)  RSS feed

 
Christian Antfeld
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everyone,

I am working with a class file that I have mislabeled with camelCase as opposed to the NormalWayOfDoingIt.  How can I change the filename? I don't really know where it is stored or anything like that.

I am also getting an error in my little program that I am using as practice:



and:




All appropriate package declarations and brackets are in the program.

I am passing 3 int arguments to the workTotal(); yet the build shows that the total is 0.  Can anyone see why this is the case?

Thank you for reading and for any help I may receive.
 
Knute Snortum
Sheriff
Posts: 4281
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To change a public class's name, just change the name in the declaration and the name of the .java file to match.  There is nowhere else that the class name is stored.  Once you do this, any other classes that use the class with a changed name will fail to compile.  You will have to change the name there too.

In an IDE, there is often a tool that will rename class names for you.
 
Knute Snortum
Sheriff
Posts: 4281
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am passing 3 int arguments to the workTotal(); yet the build shows that the total is 0.  Can anyone see why this is the case? 

The problem is you have two variables called totalWorkLoad; one is an instance variable and one is a local variable.  You set the local variable to the product of the parameters, but you display the instance variable, using the "this" keyword.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!