Hi,
Netbeans doesn’t like my nextline bit.
Im trying to prompt- enter student name
read that line
and print that string with an additional string.- e.g student name “is enrolled”
One day i hope to store the strings in an array but it is early days. Any advice would be so very helpful.
Im just starting to learn java so please be gentle
Here is my main method :goof:
package phaseone;
/**
*
*/
import java.util.Scanner;
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String args[])
{
Scanner input = new Scanner (System.in);
System.out.println("Please enter student name:"); //prompt for input
String studentName = input.[COLOR=“Blue”]nextline/COLOR; // read line of input
System.out.println(); //displaya blank line
Sn.displayName(studentName);
}
And if it helps my Sn class:goof:
package phaseone;
/**
*
*/
public class Sn
{
public void displayName( String studentName )
{
System.out.printf( studentName, “has been successfully enrolled”);
}
}