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: Small help with my code :)

  1. #1
    Junior Member
    Join Date
    Dec 2022
    Location
    My mom's womb.
    Posts
    4
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question Small help with my code :)

    I swear, this code worked for me yesterday. It didn't give me an error or anything, but today as I decided to use it again, it was full of errors. I've never encountered those before, so I don't understand what should I do.

    Here's the code:
    __________________________________________________ ________________
    package jesus;
    import java.util.*;
    public class Gangster {
    public static void main(String[] args) {
    double ew, mw;
    Scanner kb = new Scanner (System.in);
    System.out.print("Please enter your weight: ");
    ew=0.1654*mw;
    System.out.print("Your moon weight is: "+mw);
    }
    }_________________________________________________ __
    mw=moon weight.
    ew= earth weight.
    It gives me an error almost everywhere.
    The "public class" is an error (it is undefined); The System is an error (it cannot be resolved); The "import java.util.*; is an error(it cannot be resolved); The package is an error,

    If needed: I use eclipse 2022-12 IDE.
    I cannot attach images yet.

  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: Small help with my code :)

    this code worked for me yesterday
    What did you change after it worked?

    Can you copy the full text of all the error messages and paste them here so we can see it?

    Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    robolokidA (December 25th, 2022)

  4. #3
    Member
    Join Date
    Jun 2022
    Posts
    41
    Thanks
    1
    Thanked 3 Times in 2 Posts

    Default Re: Small help with my code :)

    Quote Originally Posted by robolokidA View Post
    mw=moon weight
    ew= earth weight
    This type of mapping from variable to meaning is something inherited from mathematics. Modern programming languages can incorporate that information directly into the name like so
    double moon_weight, earth_weight;

    It makes the code much more legible, and frees your mind to work on the problem rather than spending effort on memory lookups.

  5. The Following 2 Users Say Thank You to AngleWyrm For This Useful Post:

    Norm (December 25th, 2022), robolokidA (December 25th, 2022)

  6. #4
    Junior Member
    Join Date
    Dec 2022
    Location
    My mom's womb.
    Posts
    4
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: Small help with my code :)

    Hi, thanks for trying to help! However, I have found my mistake, it was pretty stupid. I just uninstalled JVM and JDK from my computer. But thank you very much





    Quote Originally Posted by AngleWyrm View Post
    This type of mapping from variable to meaning is something inherited from mathematics. Modern programming languages can incorporate that information directly into the name like so
    double moon_weight, earth_weight;

    It makes the code much more legible, and frees your mind to work on the problem rather than spending effort on memory lookups.
    It's actually a good idea, thank you!

Similar Threads

  1. Help..see the code and jst i need small help..
    By Simarpreet in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 23rd, 2014, 05:22 AM
  2. Small Problem with my Code
    By Cyril in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 20th, 2013, 03:02 AM
  3. Small problem in big code, not sure why
    By diesal11 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: October 16th, 2011, 10:25 AM
  4. WatchService - small code for monitoring folders
    By zincc in forum What's Wrong With My Code?
    Replies: 5
    Last Post: March 8th, 2011, 10:19 AM
  5. Replies: 2
    Last Post: August 1st, 2010, 06:29 AM