简体   繁体   English

如何在intellij idea中运行build

[英]how to run build in intellij idea

  import java.util.Scanner;
   public class incometax {
   public static void main(String[] args) {
   Scanner sc=new Scanner(System.in);
    System.out.println("Enter your income in lacs ");
    float tax=0;
    float income= sc.nextFloat();
        if (income < 2.5f) {
            System.out.println("You do not need to pay tax");
        } else if (income > 2.5f && income <= 5.0f) {
            tax = tax + 0.0f * (income - 2.5f);
            System.out.println("You don't need to pay taxes");
        } else if (income > 5f && income <= 7.5f) {
            //tax=tax+0.0f*(income-5f);
            tax = tax + 0.1f * (income - 5f);
        } else if (income >= 7.5f && income <= 10f) {
            //tax=tax+0.0f*(income-2.5f);
            tax = tax + 0.1f * (income - 5f);
            tax = tax + 0.15f * (income - 7.5f);
        } else if (income > 10f && income <= 12.5f) {
            tax = tax + 0.1f * (income - 5f);
            tax = tax + 0.15f * (income - 7.5f);
            tax = tax + 0.2f * (income - 10f);
        } else if (income > 12.5f && income <= 15f) {
            tax = tax + 0.1f * (income - 5f);
            tax = tax + 0.2f * (income - 7.5f);
            tax = tax + 0.2f * (income - 10f);
            tax = tax + 0.25f * (income - 12.5f);
            //tax=tax+0.15f*(income-10f);

        } else if (income > 15f) {
            tax = tax + 0.1f * (income - 5f);
            tax = tax + 0.15f * (income - 7.5f);
            tax = tax + 0.2f * (income - 10f);
            tax = tax + 0.25f * (income - 12.5f);
            tax = tax + 0.3f * (income - 15f);
        }
          System.out.println("Your total tax is :" +tax +"lacs");
      }

    }

everything fine in this code but my intellij idea not working properly whenever i rum this or any file there ide start running another file and says build failed please help me这段代码中的一切都很好,但是每当我朗读这个或那里的任何文件时,我的 intellij 想法都无法正常工作 ide 开始运行另一个文件并说构建失败请帮助我

you can build Java program using javac program1.java.您可以使用javac program1.java. or you can try this Move your code inside of the src folder.或者您可以尝试将您的代码移动到 src 文件夹中。 Once it's there, it'll be compiled on-the-fly every time it's saved.一旦它在那里,它会在每次保存时即时编译。

IntelliJ only recognizes files in specific locations as part of the project - namely, anything inside of a blue folder is specifically considered to be source code. IntelliJ 仅将特定位置的文件识别为项目的一部分——也就是说,蓝色文件夹内的任何内容都被特别视为源代码。

Also - while I can't see all of your source code - be sure that it's proper Java syntax, with a class declared the same as the file and that it has a main method (specifically public static void main(String[] args)).另外 - 虽然我看不到你所有的源代码 - 请确保它是正确的 Java 语法,声明的 class 与文件相同,并且它有一个主要方法(特别是 public static void main(String[] args) ). IntelliJ won't run code without a main method (rather, it can't - neither it nor Java would know where to start). IntelliJ 不会在没有 main 方法的情况下运行代码(相反,它不能——它和 Java 都不知道从哪里开始)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM