我使用eclipse製作了這個java計算器和一個基於文本的遊戲。我想要做的是有某種.exe或.jar文件或任何當我運行它運行我的Java程序。我希望能夠把它下載,以便其他人可以在沒有日食的情況下播放我的基於文本的遊戲。我問的是我希望我的程序能夠在瀏覽器或其他人的計算機上運行。 我不知道你爲什麼會需要它,但也許它在某處的代碼,我的繼承人計算器代碼如何把我的java程序下載
package calculator;
import java.util.Scanner;
public class calculator {
public static void main(String args[]){
Scanner test = new Scanner(System.in);
System.out.println("enter a number");
int a = test.nextInt();
System.out.println("enter 1 to add 2 to subtract 3 to multiply 4 for divide");
int t = test.nextInt();
if(t == 1){
System.out.println("enter the second number");
int g = test.nextInt();
int u = a + g;
System.out.println("The answer is " + u);
}
if(t == 2){
System.out.println("enter the second number");
int l = test.nextInt();
int m = a - l;
System.out.println("The answer is " + m);
}
if(t == 3){
System.out.println("enter the second number");
int j = test.nextInt();
int v = a * j;
System.out.println("The answer is " + v);
}
if(t == 4){
System.out.println("enter the second number");
int p = test.nextInt();
int z = a/p;
System.out.println("The answer is " + z);
}
}
}