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.

How do project names, class names, and file names relate to one another in GDB's Java?

+7 votes
asked Aug 14, 2019 by donnabrich1 (190 points)
Using Java on this platform, does every project consist of a main class with a  main method (and others as needed), or can I use the project name for the class name?

2 Answers

0 votes
answered Jun 5, 2025 by THIRSHA M (140 points)
you can use the project name as class name, but you have to rename the file name from main.java to your projectname.java
+1 vote
answered Jun 12, 2025 by SAI KAVITI (180 points)
package com.example;

public class MyClass {
    public native void sayHello();
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...