I’m writing a program for my intro to Java class. I’m getting an error message, and I can’t figure out what exactly it’s telling me or how to resolve the issue. This is the message:
packageCost.java:17: incompatible types
found : void
required: java.lang.String
input = System.out.print("Please enter the weight of " +
^
packageCost.java:22: incompatible types
found : void
required: java.lang.String
input = System.out.print("How many miles is this " +
^
2 errors
Any help would be appreciated.
Your attempting to assign a String to “System.out.print(“Please enter..”);
System.out.print returns “void” which is not String, thus incompatible types.
It looks like your trying to do console input. You could use a Scanner to do this.
Try something like
Read about Scanner class, Just google it.