[英]How to instantiate a class in a Java .class using Visual Studio Code?
I am using Visual Studio Code (version 1.32.3)
with Java
. 我正在使用
Visual Studio Code (version 1.32.3)
和Java
。 I have a .class file called 'RandomGenerator.class' which I want to instantiate from the main. 我有一个名为'RandomGenerator.class'的.class文件,我想从main实例化。 The main.java and RandomGenerator.class are in the same directory.
main.java和RandomGenerator.class位于同一目录中。
My statement: 我的声明:
RandomGenerator rdgen = new RandomGenerator(1,1,1,1);
will have an error : RandomGenerator could not be resolved to a type java(16777218)
将出现错误:
RandomGenerator could not be resolved to a type java(16777218)
I tried to include import RandomGenerator; 我试图包含import RandomGenerator; (I don't need but try to see if it is required) - I get an error
"RandomGenerator cannot be resolved java(268435846)"
at the import statement. (我不需要但是试着看看是否需要) - 我在import语句中得到一个错误
"RandomGenerator cannot be resolved java(268435846)"
。
The specification of the constructor given is RandomGenerator(int seed, double lambda, double mu, double rho)
给定的构造函数的规范是
RandomGenerator(int seed, double lambda, double mu, double rho)
Appreciate help to make it work in Visual Studio Code. 感谢帮助使其在Visual Studio Code中运行。 Thanks.
谢谢。
If that does not work - is RandomGenerator visible or your class, ie public or package private and in the same package? 如果这不起作用 - RandomGenerator是可见的还是您的类,即公共或包私有并且在同一个包中?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.