I have a question about the command failed error related to the hash code executor Java code

Asked 2 years ago, Updated 2 years ago, 29 views

public class subject {

 // Member variable


  String subcode;
  String subtype;//Completed
  String gradenum;//Completed
  String subpurpose;
  String subgoal;
  String subbook;
  String subname;
  String profname;
  boolean subinformation;

You posted your answer last time, so after changing the member variable, class name, and member function to English, It was all done while correcting the errors in the middle

Command failed: /undefined.java:1: error: class subject is public, should be declared in a file named subject.java public class subject { ^ 1 error

There is this error again at the end, and I wonder what the problem is... I really don't know how to solve this error in the hash code executor.

java

2022-09-22 21:42

1 Answers

In Java, the public class must be the same as the file name. However, the code executor does not support multiple files, so if you want to use multiple classes, you must remove public and paste the class under the code.


2022-09-22 21:42

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.