class CustomString is public, should be declared in a file named CustomString.java public class CustomString { ^ 1 error

Viewed 27

I'm getting this error.

here is my code:


import java.util.HashMap;

import java.util.Map;

public class CustomString {

    // instance attributes
    String myString;
    boolean isSet;

    /**
     * initializing the instance attribute
     */
    public CustomString() {
        myString = null;
        isSet = false;

    }
1 Answers
  1. rename your file to CustomString.java
  2. you are missing a }at the end of your code
Related