Java: “error: cannot find symbol”

前端 未结 3 930
借酒劲吻你
借酒劲吻你 2021-01-18 19:56

(Rookie mistake, I\'m sure.)

I\'m a first year computer science student, and attempting to write a program for an assignment, with the code;

import          


        
3条回答
  •  我在风中等你
    2021-01-18 20:34

    import java.util.Scanner;
    public class Lab10Ex1 {
    
       private static int n;
    
       public static void main(String[] arg) {
        Scanner keyboard = new Scanner(System.in);
        System.out.println("Please type a number: ");
         n = keyboard.nextInt(); 
        calcNumFactors();
      }
      public static void calcNumFactors(){
    
       System.out.print(n + 1);
    
      }
    }
    

提交回复
热议问题