欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-06-16 18:41:22
Error:Launch configuration Hi references non-existing project hi.Key:原文件上右键Run As -> Java Application...

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