Results 1 to 11 of 11
Like Tree2Likes
  • 2 Post By Fubarable

Thread: Help with code : Ultra Noob

  1. #1
    deepode is offline Member
    Join Date
    Apr 2012
    Location
    Gujarat , India
    Posts
    5
    Rep Power
    0

    Question Help with code : Ultra Noob

    I am trying to learn Java & I am extremely noob, hope this forums help me. :-/
    In the following code i am trying to get width & height and print area of rectangle. what's problem?

    Java Code:
    public class SomethingIsRight {
        public static void main(String[] args) {
        	public Rectangle (int width, int height) {
        		area = width*height;
        		}
            
            Rectangle myRect = new Rectangle(40,50);
            System.out.println("myRect's area is " + myRect.area());
        }
    }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Help with code : Ultra Noob

    Quote Originally Posted by deepode View Post
    what's problem?
    First you tell us: what errors are you seeing? You should post your entire error message here always.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: Help with code : Ultra Noob

    You didn't bother to return to either of the first two threads you started. You didn't bother to check out the link I posted in the second thread. This third thread is once again a violation of the forum rules.

    Do you really expect the forum members to try to help you?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    deepode is offline Member
    Join Date
    Apr 2012
    Location
    Gujarat , India
    Posts
    5
    Rep Power
    0

    Default Re: Help with code : Ultra Noob

    Quote Originally Posted by Fubarable View Post
    First you tell us: what errors are you seeing? You should post your entire error message here always.
    I just want to know that how to find area of rectangle!

    You didn't bother to return to either of the first two threads you started. You didn't bother to check out the link I posted in the second thread. This third thread is once again a violation of the forum rules.

    Do you really expect the forum members to try to help you?

    db
    Sorry, but after long time i have logged in and now i don't even remember what i asked. Sorry, hope you answer.

  5. #5
    awinston is offline Student
    Join Date
    Jul 2012
    Location
    United States
    Posts
    328
    Rep Power
    3

    Default Re: Help with code : Ultra Noob

    Quote Originally Posted by deepode View Post
    In the following code i am trying to get width & height and print area of rectangle. what's problem?
    The problem is that you define a constructor for class Rectangle inside the main method of class SomethingIsRight.

    Another problem is that you call the undefined method area().

    I recommend that you start with the Hello World Tutorial. Then, start learning about Objects and Classes plus other elements of the Java language.
    "Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill

  6. #6
    awinston is offline Student
    Join Date
    Jul 2012
    Location
    United States
    Posts
    328
    Rep Power
    3

    Default Re: Help with code : Ultra Noob

    Quote Originally Posted by deepode View Post
    Sorry, but after long time i have logged in and now i don't even remember what i asked. Sorry, hope you answer.
    You can view all of your posts by clicking on "My Profile" at the top-right portion of the screen. Then Click on "Find latest posts" on the left side of the screen.

    Also, you don't have to put the word "noob" in all of your thread titles. If you are posting in the New to Java section, people assume that you are a beginner at Java.
    "Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Help with code : Ultra Noob

    Quote Originally Posted by awinston View Post
    The problem is that you define a constructor for class Rectangle inside the main method of class SomethingIsRight.
    Which would cause a compilation error -- which is why I wanted the original poster to tell us his error message, since it's obvious he should get them, and since he should learn not to ignore them. But he ignored my request for some reason.

  8. #8
    awinston is offline Student
    Join Date
    Jul 2012
    Location
    United States
    Posts
    328
    Rep Power
    3

    Default Re: Help with code : Ultra Noob

    Quote Originally Posted by Fubarable View Post
    Which would cause a compilation error -- which is why I wanted the original poster to tell us his error message, since it's obvious he should get them, and since he should learn not to ignore them. But he ignored my request for some reason.
    Right, sorry about jumping ahead of you. I saw that he ignored your request in his last post, so I figured that he would probably continue to ignore it.
    "Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Help with code : Ultra Noob

    No you're OK in posting what you've posted. It's time to be blunt I think.
    awinston and DarrylBurke like this.

  10. #10
    deepode is offline Member
    Join Date
    Apr 2012
    Location
    Gujarat , India
    Posts
    5
    Rep Power
    0

    Default Re: Help with code : Ultra Noob

    Thank you all! I was already going through tutorial! Then I founded another site & it helped me alot! Thank you a lot friends!!! :D

  11. #11
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Help with code : Ultra Noob

    Quote Originally Posted by deepode View Post
    Thank you all! I was already going through tutorial! Then I founded another site & it helped me alot! Thank you a lot friends!!! :D
    Great. Have fun with your new friends.

Similar Threads

  1. Very noob : Pls describe this code :P
    By deepode in forum New To Java
    Replies: 2
    Last Post: 07-24-2012, 07:53 PM
  2. I am a super noob with a super noob question.
    By LittleZoppo in forum Java Applets
    Replies: 3
    Last Post: 04-27-2012, 03:50 AM
  3. Java Ultra-Lite Persistence 3.0.2
    By java software in forum Java Software
    Replies: 0
    Last Post: 10-10-2011, 05:59 PM
  4. Help im a noob.. a super noob on java..
    By critdevil in forum New To Java
    Replies: 12
    Last Post: 03-07-2009, 03:17 AM
  5. Noob
    By nokomis in forum Introductions
    Replies: 2
    Last Post: 03-06-2009, 05:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •