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?
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());
}
}
Re: Help with code : Ultra Noob
Quote:
Originally Posted by
deepode
what's problem?
First you tell us: what errors are you seeing? You should post your entire error message here always.
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
Re: Help with code : Ultra Noob
Quote:
Originally Posted by
Fubarable
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!
Quote:
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.
Re: Help with code : Ultra Noob
Quote:
Originally Posted by
deepode
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.
Re: Help with code : Ultra Noob
Quote:
Originally Posted by
deepode
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.
Re: Help with code : Ultra Noob
Quote:
Originally Posted by
awinston
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.
Re: Help with code : Ultra Noob
Quote:
Originally Posted by
Fubarable
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.
Re: Help with code : Ultra Noob
No you're OK in posting what you've posted. It's time to be blunt I think.
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
Re: Help with code : Ultra Noob
Quote:
Originally Posted by
deepode
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.