I started using intellij I want to know how to run my console application

Asked

Viewed 483 times

0

hello I started the java program a short time ago, and a friend who is more experienced recommended me to use the Intellij as you see, I have already set up the ide in a basic way, javac for CMD, but I can’t run my console codes inside the ide, I tried to choose different types of templates within the platform, but no function or seemed appropriate for my code. the code in question is :

import java.util.Scanner; //1. importando a classe scanner 
public class Exemplo1 {
public static void main(String[] args) {
//2. instanciando e criando um objeto scanner 
Scanner ler = new Scanner(System.in);

int i, n;

System.out.printf("informe o numero para a tabuada:\n");
n = ler.nextInt(); //3.1 entrada de dados (lendo um valor inteiro)

System.out.printf("\n+--resultado--+\n");
for (i=1; i<=10; i++) { 
    System.out.printf("| %2d * %d = %2d |\n", i, n, (i*n));
}   
System.out.printf("+----------------+\n");
}

}
here the code I’d like to run by the intellij

I wonder if it is possible to do this and how to set up the ide properly

  • In the basics, you create a java project in intellij, define the JDK to be used, create a package, create a main class as you created it, and then click run. Have you tried using hello world java intellij? Link: [https://www.jetbrains.com/help/idea/creating-and-running-your-first-java-application.html#]

  • thanks, I realized that my jdk was not installed properly.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.