自定义包时出现的问题package com.juj;public class Point{ private int x,
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/12 06:19:37
自定义包时出现的问题
package com.juj;
public class Point
{
private int x,y;
public Point() {}
public Point(int x,int y) {this.x=x;this.y=y;}
public void setx(int a) {x=a;}
public int getx() {return x;}
public void sety(int a) {y=a;}
public int gety() {return y;}
}这是我定义包的源代码放在c:\jdk1.6.0_02\jre\classes下面的
import com.juj.Point;
public class MDPoint2
{
public static void main(String args[])
{
Point a=new Point();
Point p=new Point(3,5);
p.setx(6);
System.out.println("P 点间的x,y坐标为:"+p.getx()+","+p.gety());
System.out.println("a 点间的x,y坐标为:"+a.getx()+","+a.gety());
}
}这是我写的一个引用上面包的类的一个程序 编译时都通过了 运行的时候
java MDPoint2以后
Exception in thread "main" java.lang.NoClassDefFoundError:com/juj/Point at MDPoint2.main实在不知道怎么办了 各位大虾帮帮忙
package com.juj;
public class Point
{
private int x,y;
public Point() {}
public Point(int x,int y) {this.x=x;this.y=y;}
public void setx(int a) {x=a;}
public int getx() {return x;}
public void sety(int a) {y=a;}
public int gety() {return y;}
}这是我定义包的源代码放在c:\jdk1.6.0_02\jre\classes下面的
import com.juj.Point;
public class MDPoint2
{
public static void main(String args[])
{
Point a=new Point();
Point p=new Point(3,5);
p.setx(6);
System.out.println("P 点间的x,y坐标为:"+p.getx()+","+p.gety());
System.out.println("a 点间的x,y坐标为:"+a.getx()+","+a.gety());
}
}这是我写的一个引用上面包的类的一个程序 编译时都通过了 运行的时候
java MDPoint2以后
Exception in thread "main" java.lang.NoClassDefFoundError:com/juj/Point at MDPoint2.main实在不知道怎么办了 各位大虾帮帮忙
你应该先搞清楚包的概念
理解清楚后,你这里只要把你编译好的Point.class放在目录c:\jdk1.6.0_02\jre\classes\com/juj下面就可以了
理解清楚后,你这里只要把你编译好的Point.class放在目录c:\jdk1.6.0_02\jre\classes\com/juj下面就可以了
自定义包时出现的问题package com.juj;public class Point{ private int x,
class Point{ protected int x,y; public Point(){} public Poin
已知有如下类的定义:public class Point { private double x,y; public Po
这道题我搞不懂,20.public class SychTest{ private int x; private int
#include class base { Private:int x,y; public:void setxy(int
class Point{ private double x; private double y; Point(doubl
class Point { int x_,y_; public:Point():x_(0),y_(0){} Point(
C++中 private和public的问题
1.给出如下代码:class Test{ private int m; public static void fun()
X=xx,#include#includeusing namespace std;class point {public
类定义为什么要这样class point{public:double x,y;point(){};point(doubl
class A{int i,j;public:static int x;public:A(int a = 0,int b