I want to capture user input ( for teaching purposes - not an actual application). I don't want to use the dialgoue scenario - I just want to KIS and use Java principles.
I have:
The Greenfoot terminal opens, prompting for input, but that's all I can get it to do.
Your help would be appreciated.
import java.util.Scanner;
public class Input extends Actor
{
private static Scanner scan;
public void act()
{
// Add your action code here.
input();
}
public void input(){
int a;
float b;
String s;
Scanner in = new Scanner(System.in);
System.out.println("Enter a string");
s = in.nextLine();
System.out.println("You entered string "+s);
}
}

