Java is a very powerful and versatile programming language. One of the reasons why Java is so popular is due to the fact that Java programs can run on many different devices and platforms.
Unfortunately, all of that power comes at a price: Java's input and output (particular the input) can be quite complicated and intimidating for new programmers.
To help resolve this, I use a special library of input commands for students who are new to Java (ICS3U). Here is how to get it working:
Now that you have add the extra class path, you should have access to all of the input methods contained inside In.class. Here is some sample code to get you started:
class TestInClass
{
public static void main(String[] args)
{
System.out.println("Integer value?");
int x = In.getInt();
System.out.println("Decimal value?");
double y = In.getDouble();
System.out.println("String value?");
String z = In.getString();
System.out.println("The integer was " + x);
System.out.println("The double was " + y);
System.out.println("The string was " + z);
}
}