aspose file tools*
The moose likes Beginning Java and the fly likes .class error in main Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark ".class error in main" Watch ".class error in main" New topic
Author

.class error in main

Nokomis Sheridan
Greenhorn

Joined: Dec 05, 2005
Posts: 6
I'm not sure what I'm doing wrong, but I am getting a .class error in my main method. Could someone please look at it for me?

public class Compact
{
int data[] = new int[100];
int count = 0;

public static void main(String[] args)
{
System.out.println("Compact.java by Chicken Little");
System.out.println();
Compact a = new Compact();
a.removeZeros();
}
public Compact()
{
String fileName = "readme.txt";
FileInput inFile = new FileInput(fileName);
while (inFile.hasMoreTokens())
{
data[count] = inFile.readInt();
count++;
}
}
public void removeZeros(int arrayWithZeros[])
{
for (int i = 0; i < arrayWithZeros.length; i++)
{
if (arrayWithZeros[i] == 0)
{
// Move all elements 1 position
for (int j = i; j < arrayWithZeros.length - 1; j++)
{
arrayWithZeros[j] = arrayWithZeros[j+1];
}
// Then put something at the end, in this case, i want to put a -1
arrayWithZeros[arrayWithZeros.length - 1] = -1;
}
System.out.println(arrayWithZeros[i]);
}
}

}
Nokomis Sheridan
Greenhorn

Joined: Dec 05, 2005
Posts: 6
Did I break the question rule? I didn't think it was that difficult...just for me it was.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"Chicken Little"

Welcome to the JavaRanch.

We're a friendly bunch, but we are very serious when it comes to display names. We require display names to be two words: your foirst name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name.

thanks,
Dave
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Can please post the error you get? This will give us a better chance of helping you with your problem.

Dave
Nokomis Sheridan
Greenhorn

Joined: Dec 05, 2005
Posts: 6
oops! sorry!

it's fixed now!
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Thanks, I appreciate it. Do you have an error for us?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: .class error in main