The Beginner's Guide to Jump Rope - The final push of theQ:
Class file does not get recognized
I have the following class file:
public class Util
{
public void simpleGet(String a)
{
System.out.println("exists: " + a);
}
public void set(String a, String b)
{
System.out.println("exist: " + a + ", " + b);
}
}
Then I try to compile the file using:
javac -classpath../Util/ Util.java
But I receive the following errors:
Util.java:2: error: illegal start of expression
public class Util
^
Util.java:6: error: class, interface, or enum expected
public void simpleGet(String a)
^
Util.java:10: error: class, interface, or enum expected
public void set(String a, String b)
^
5 errors
What's wrong here?
A:
There are errors in your code, that's why javac gives you the errors.
The method simpleGet is not public. Java says class Util is public, but the method is not. So you can't call it.
You can't have a class and an interface in the same file.
And here's a modified version of your code, which is fine:
public class Util {
public void simpleGet(String a) {
System.out.println("exists: " + a);
}
public void set(String a, String b) {
System.out.println("exist: " + a + ", " + b);
}
}
Q:
How can I use a custom font in a C# app that will run on Windows and Mac?
I'm developing a program in C# that ac619d1d87
Related links:
Comments