0

Im sorry if this seems newbish, but i know we all gotta start some where.. its stopping me from putting the users data after dessert , well before it...this is an edit question

package scanners; import java.util.Scanner;

public class usingscanners {

public static void main(String[] args) {
    // TODO Auto-generated method stub
    Scanner sc = new Scanner(System.in);
    String userName;
    int age; 
    String dessert;
    
    
    System.out.println("Hi What is your name? ");
    
     userName = sc.nextLine();
    
    System.out.println ("How are you doing, " + userName + "?");
    System.out.println ("What is you age, " + userName + "?");
    
    age = sc.nextInt();
    
    System.out.println ("Hello, " + userName +  " you are " + age);
    
    System.out.println ("ok, " + userName + " .Your are " + age + "." + " What is your favorite dessert?"); 
      
    dessert = sc.nextLine();
    
    System.out.println (" Hello, " + userName + "You are " + age + " and your favorite dessert is " + dessert);
    
    
    
    
}

}

swoly
  • 21
  • 2

1 Answers1

0

age is an integer, use age = sc.nextInt();