[問題] 無法編譯(我的電腦的問題...)
==佔內儲存==
先說明一下
我的code在我朋友的電腦可以執行
但是他就是不給我跑過去XD
出現的畫面...
EX_4.java:5: cannot find symbol
symbol : class Data
location : class EX_4
Data input = new Data();
^
EX_4.java:5: cannot find symbol
symbol : class Data
location : class EX_4
Data input = new Data();
^
2 error
ps.我的code真的可以在我朋友的電腦上跑...
CODE_1:
import java.util.Scanner;
public class Data
{
private int m;
private int n;
private int gcd;
public void set()
{
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter numerator");
m = keyboard.nextInt();
System.out.println("Enter denominator");
n = keyboard.nextInt();
}
public void printGcd(int m ,int n)
{
int temp_1 = m,
temp_2 = n,
temp_3 = 1;
int gcd;
while(true)
{
temp_3 = temp_1 % temp_2;
if(temp_3 == 0)
{
break;
}
temp_1 = temp_2;
temp_2 = temp_3;
}
gcd = temp_2;
}
public void printResult(int m, int n, int gcd)
{
String output;
int p ;
int q ;
p = m / gcd;
q = n / gcd;
output = p + " / " + q;
System.out.println("The GCD(great common divisor) is " + gcd);
System.out.println("The result is " + output);
}
}
CODE_2:
public class EX_4
{
public static void main(String[] args)
{
Data input = new Data();
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.112.49.13
推
03/31 22:17, , 1F
03/31 22:17, 1F
java 近期熱門文章
PTT數位生活區 即時熱門文章