关于#java#的最基础问题,求解答

纯新生求解,多谢了

问题1:

public class DebugTwo1
{
   public static void main(String[] args)
   {
      int a = 315;
      double b = 12.4;

      System.out.print("The int is ");
      System.out.println(int);
      System.out.print("The double is ");
      System.out.println(double);

   }
}

输出的int和double有问题,具体是什么问题也没看懂quq

问题2:

public class DebugTwo2
//  This application performs arithmetic with two integers
{
  public static void main(String args[])
  {
    int a, b;
    7 = a;
    4 = b;
   System.out.println("The sum is '+ a + b'");
   System.out.println("The difference is '+ a - b'");
   System.out.println("The product is '+ a * b'");
}
  }

7和4不是变量

问题3:

public class DebugTwo3
// Demonstrates remainder and output
{
  public static void main(String args[])
  {
      double a = 99, b = 8 ;
      int c = 77;
      result = a % b;
      System.out.println("Divide " + a + " by " + b);
      System.out.println("remainder is " + result);
      System.out.print("c is a very large number:");
      System.out.println(c);
   }

}

result不能解析为一个变量

谢谢了

第一个代码:
要打印 变量名 a和b,而不是打印变量类型。

第二个代码:
给变量赋值时,变量名应该在前边。 如a=7

第三个代码:
使用变量时,要先申明变量,如 double result = a % b;

你这三个问题本质上都是同一个问题
就是你根本不知道什么叫变量,变量应该如何定义,以及变量名称应该符合什么标准
回去先看书,不要凭感觉瞎写

问题1

public class DebugTwo1
{
   public static void main(String[] args)
   {
      int a = 315;
      double b = 12.4;
 
      System.out.print("The int is ");
      System.out.println(a);
      System.out.print("The double is ");
      System.out.println(b);
 
   }
}

问题2

public class DebugTwo2
//  This application performs arithmetic with two integers
{
  public static void main(String args[])
  {
    int a, b;
    a=7;
    b=4;
   System.out.println("The sum is"+ a + b);
   System.out.println("The difference is"+ a - b);
   System.out.println("The product is "+ a * b);
  }
}

问题三 double result

public class DebugTwo3
// Demonstrates remainder and output
{
  public static void main(String args[])
  {
      double a = 99, b = 8 ;
      int c = 77;
      int result = a % b;
      System.out.println("Divide " + a + " by " + b);
      System.out.println("remainder is " + result);
      System.out.print("c is a very large number:");
      System.out.println(c);
   }
}