Below is the start of my program but i need to have the filename of yournamehw1.java.
import java.util.Scanner;
public class Divide {
public static void main (String args [] ) {
make kybd = new Scanner (System.in);
System.out.print("Enter number 1: ");
1
Expert's answer
2011-10-04T10:24:57-0400
There a some constrains in Java: Only one "public class" can be in file. So you can not write: public class Cl1 { } public class Cl2 { } in same file.
Also name of file must be the same as name of "public class". So if you write public class Cl1 { } it must be written in Cl1.java.
So, you can rename your class to yournamehw1, or rename file to Divide.java. It is also possible to create public class yournamehw1 in yournamehw1.java and class Divide(not public) in yournamehw1.java, but it will be visible only in yournamehw1.java.
Comments
Leave a comment