记录看翁恺老师java视频中遇到的问题和解决方法
P3 1-1第一个程序-3
ERROR:Launch configuration Hi references non-existing project hi.
Key:原文件上右键Run As → Java Application
P4 1-2用变量做计算-1
输入 eg.Scanner in = new Scanner(System.in); 之前
在程序开头加上 import java.util.Scanner;
Alt+/ 自动补齐输入
Ctrl+/ 备注
package hello;
import java.util.Scanner;
public class Hello {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("你好");//你好
// Scanner in = new Scanner(System.in);
// System.out.println("echo:" + in.nextLine());
System.out.println("2+3="+5);//2+3=5
System.out.println("2+3="+(2+3));//2+3=5
System.out.println(2+3+"=2+3="+(2+3));//5=2+3=5
}
}
P5 1-2用变量做计算-2
package hello;
import java.util.Scanner;
public class Hello {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("你好");
Scanner in = new Scanner(System.in);
// System.out.println("echo:" + in.nextLine());
int price;
price= in.nextInt();
System.out.println("100-"+price+"="+(100-price));
}
}
本文地址:https://blog.csdn.net/dorris_/article/details/107294265
上一篇: 数据分析SQL零基础入门——0.课程导言