January 4, 200620 yr 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.
January 4, 200620 yr 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{"
January 4, 200620 yr Author 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, 200620 yr by I_Broke_My_MHZ
Create an account or sign in to comment