Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Compile 2 classes ?

+3 votes
asked Aug 21, 2023 by lzgo (180 points)
hello , it is possible to compile here in gdb online ; compile 2 classes ?
I was able to compile and run a class and test without any problems. But I need to compile an extended class and it gives an error.

1 Answer

0 votes
answered Aug 27, 2023 by Peter Minarik (88,520 points)
selected Sep 10, 2023 by lzgo
Best answer

Please, share your code. Also, your question is tagged with both Java and C language, so which one are you talking about? (I suspect Java.)

For Java, every class has to go to its own file with the same name as the class itself. E.g., Employee.java would hold the Employee class.

commented Aug 30, 2023 by Benedikt Moore (100 points)
do you know if i need to import classes  specially (or is it just available the same way a import * from module  would make every class available)    (java )
commented Sep 3, 2023 by Peter Minarik (88,520 points)
As long as they are next to your Main.java, no import is needed, they will be detected by the compiler.
commented Sep 10, 2023 by lzgo (180 points)
Hi, thanks for the answer. It's Java, I was able to compile the classes in gdb online, very good.
It was a syntax error.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.