Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: How to create a .java file?

  1. #1
    Junior Member
    Join Date
    Apr 2021
    Location
    Roma-Italy
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to create a .java file?

    I have compiled a program on a text editor, the program being one example from the book I am studying, i saved it as produzioneScooter.java on my desktop, then I imported in GDB compiler online and launched it. An error comes out, that produzioneScooter is a public class and this must be stated in a produzioneScooter.java file. But as a matter of fact I already created such a file so what's wrong here? Please help me I am completely stuck with this problem

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: How to create a .java file?

    produzioneScooter is a public class and this must be stated in a produzioneScooter.java file.
    A public class must be contained in a .java file with the same name as the class.

    I don't know anything about a GDB compiler. I use the JDK downloaded from the Oracle site.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Member
    Join Date
    Jul 2019
    Posts
    36
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Default Re: How to create a .java file?

    try rename command in the menu on the tab and check filename, be sure there is .java extension
    this is ok:
    https://onlinegdb.com/H17A9EIHO

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: How to create a .java file?

    Is the problem fixed now?
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. how to create excel file in java
    By viral.bhat in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 31st, 2014, 11:11 AM
  2. how can i create batch file using java ...
    By santosh tiwary in forum What's Wrong With My Code?
    Replies: 6
    Last Post: December 9th, 2013, 10:14 AM
  3. Create a file specifying the size JAVA
    By Harbox in forum Java Theory & Questions
    Replies: 3
    Last Post: September 20th, 2012, 10:30 AM
  4. create file in java
    By pokuri in forum Object Oriented Programming
    Replies: 2
    Last Post: January 19th, 2011, 10:42 AM
  5. Replies: 10
    Last Post: January 12th, 2011, 05:48 AM