I_Broke_My_MHZ Posted January 4, 2006 Posted January 4, 2006 I must be losing it. Every time I try to compile this simple program it is giving me a "illegal start of type" error.import java.util.Random;public class tesn{ public void hi(void){ System.out.println("DoSTuff"); } public static void main(String args[]){ hi(); }}The filename is called tesn.java. I have no idea why this does not work.
phatcat42141 Posted January 4, 2006 Posted January 4, 2006 I must be losing it. Every time I try to compile this simple program it is giving me a "illegal start of type" error.import java.util.Random;public class tesn{ public void hi(void){ System.out.println("DoSTuff"); } public static void main(String args[]){ hi(); }}The filename is called tesn.java. I have no idea why this does not work.Shouldn't it be something like this -- import java.util.Random;public class test{ public void hi(void){ System.out.println("DoSTuff"); } public static void main(String args[]){ hi(); }}You have "public class tesn{" and I think it should be "public class test{"
I_Broke_My_MHZ Posted January 4, 2006 Author Posted January 4, 2006 (edited) Nope that isn't it. The class name "tesn" matches the name of the file "tesn.java". It's an odd name, but as long as it matches it should work.Edit: I figured it out. The void isn't suppost to be where the arguments are. I hate it when I confuse languages. Edited January 5, 2006 by I_Broke_My_MHZ
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now