Hello, I am new to java and I have to code a class. The demonstrator from my course told me to use another class to create a type that is needed in my class, however, I cannot compile due to errors with the declaration of that class. I have checked the chapter in my java book that relates to class declaring and still don't see the issue.
This is the code:
Ok, let me rephrase this then, what do you think would solve my problem ? Or do you think that creating a different file for "tab" would work ? (in the end, i am just asking for your opinion, not saying that you said or implied that. But whatever.)
It's hard to say. That code which Henry posted... did you mean it to be a class? (Henry pointed out several problems with it, if it was supposed to be a class.) If you did, then yes you should put it in its own file. But that's only one thing you should do. The other things... well, they were what Henry actually said.
You are writing too much code before finding mistakes. You should not write more than about 5 lines without compiling it. Then you would have known because you would have got an error saying “class interface or enum expected”.
You have got some spelling errors in what you quoted, so the code won’t compile. You should always use ctrl-C ctrl-V to copy code. You have also some code //commented out. We do not need to see that.
You have some incorrect naming conventions, eg use of underscores_ in_ identifiers_.
You should not use StringTokenizer; click on that link to find out why.
I don't remember, I got blocked after that, and I realized the way I had approached the problem with was just way too complicated so I started from scratch again. My file now compiles and executes when tested with another program. Thank you for sparing me with your time.