public class HelloWorldApp {
public static void main(String[] args) {
System.out.println("hello world");
}
}
برای اینکه به صورت کنسول برنامه رو از پوشه ی dist اجرا کنید:
۱- میری تو registry و با ctrl+f دنبال jarfile میگردی (با F3 میری بعدی تا پیدا کنی)
۲- در jarfile در shell کنار open یک key دیگه میسازی به نام مثلا run as console و توش یک key میسازی به نام command
۳- داخل قسمت command میای و data رو به همون دیتای open-> command تغییر می دی و فقط w رو از آخرش برمیداری
public class HelloWorldApp {
public static void main(String[] args) {
int n = 10;
System.out.format("hello world %d", n);
}
}
# format specifires:
# %d decimal => 8digit number: %08d. => separate 3 digi 3 digi : %,d.
# %d format: %0+,ld
# %f floats
# %s strings
package inputproject;
import java.util.Scanner;
public class InputProject {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("enter an int num:");
int n = input.nextInt();
System.out.format("the number is %d \n", n);
}
}
import java.util.Scanner;
// or import java.util.*
public class HelloWorldApp {
public static void main(String[] args) {
System.out.println("hello world!");
System.out.println("Press Enter to continue...");
Scanner input = new Scanner (System.in);
input.nextLine();
}
}