想问一个关于对象和类java的问题。为什么我的代码运行不了。今天看了好久了。
packagetwotwo;importjava.util.Scanner;publicclassMain{/***@paramargs*/publicstaticvoi...
package twotwo;
import java.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
Fraction a=new Fraction(1,2);}}
class Fraction{
int fenzi;
int fenmu;
public Fraction(int a, int b) {
// TODO Auto-generated constructor stub
this.fenzi=a;
this.fenmu=b;
}} 展开
import java.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
Fraction a=new Fraction(1,2);}}
class Fraction{
int fenzi;
int fenmu;
public Fraction(int a, int b) {
// TODO Auto-generated constructor stub
this.fenzi=a;
this.fenmu=b;
}} 展开
1个回答
展开全部
package twotwo;
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Fraction a = new Fraction(1, 2);
}
}
class Fraction
{
int fenzi;
int fenmu;
public Fraction(int a, int b)
{
// TODO Auto-generated constructor stub
this.fenzi = a;
this.fenmu = b;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询