[英]Won't run the class, Java
I was following a book on to learn java when it told me to enter this code: 当我告诉我输入以下代码时,我正在关注一本关于学习Java的书:
package com.thekyle.hi;
class Myclass {
int x;
Myclass(int i) {
x = i;
}
}
class ParmsConsDemo {
public static void main(String args[]) {
Myclass t1 = new Myclass(10);
Myclass t2 = new Myclass(88);
System.out.println(t1.x + " " + t2.x);
}
}// OutPut is 10 88
And it will launch a different class than this one. 它将推出与本课程不同的课程。 How do I make it launch?
如何启动它?
Do this as follows 如下进行
Make ParmsConsDemo
public. 将
ParmsConsDemo
公开。
...
public class ParmsConsDemo {
...
public static void main(String[] args){
..
}
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.