Программисты JAVA общаются здесь
-
Anonymous
У меня возникла проблема с ошибкой компиляции пакета Java.
Сообщение
Anonymous »
Я получаю эту ошибку, когда компилирую объявление пакета в Java в командной строке
Код: Выделить всё
javac -d .\java_shorts.java
.\java_shorts.java:3: error: class, interface, enum, or record expected
package shorts;
^
1 error
Код: Выделить всё
//java_shorts.java file
import java.io.Printwriter;
package shorts;
public static class java_shorts
{
public static void command_line_output(String string_input)
{
System.out.print(string_input);
}
public static int random_number_generator_range_exclude_data_base()
{
}
public static void hello_world()
{
command_line_output("hello_world \n\n");
}
}
////////////////////
/////main call file
import account_methods.account_core;
import shorts.java_shorts;
public class account_main
{
public static void main (String args[])
{
java_shorts short_java = new java_shorts();
short_java.hello_world();
}
}
Я надеялся импортировать класс из внешнего файла.
Подробнее здесь:
https://stackoverflow.com/questions/790 ... pile-error
1727171209
Anonymous
Я получаю эту ошибку, когда компилирую объявление пакета в Java в командной строке
[code]javac -d .\java_shorts.java
.\java_shorts.java:3: error: class, interface, enum, or record expected
package shorts;
^
1 error
[/code]
[code]//java_shorts.java file
import java.io.Printwriter;
package shorts;
public static class java_shorts
{
public static void command_line_output(String string_input)
{
System.out.print(string_input);
}
public static int random_number_generator_range_exclude_data_base()
{
}
public static void hello_world()
{
command_line_output("hello_world \n\n");
}
}
////////////////////
/////main call file
import account_methods.account_core;
import shorts.java_shorts;
public class account_main
{
public static void main (String args[])
{
java_shorts short_java = new java_shorts();
short_java.hello_world();
}
}
[/code]
Я надеялся импортировать класс из внешнего файла.
Подробнее здесь: [url]https://stackoverflow.com/questions/79008302/i-am-having-an-issue-with-java-package-compile-error[/url]