当前位置: 移动技术网 > IT编程>开发语言>Java > 记录看翁恺老师java视频中遇到的问题和解决方法

记录看翁恺老师java视频中遇到的问题和解决方法

2020年07月13日  | 移动技术网IT编程  | 我要评论

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

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网