Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.help Subject: Re: i am new to java . Date: Wed, 2 Sep 2020 08:09:36 -0400 Organization: A noiseless patient Spider Lines: 47 Message-ID: References: <0a492d77-0dfc-4efc-83b2-27698a0856f7n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 2 Sep 2020 12:09:38 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="2746f3b9e80e5f39e3221934df6f2f27"; logging-data="21953"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/AQwLvxd8w9inY3hp3E9Z5" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 Cancel-Lock: sha1:XuvoaBrBvP3C6mSDGpm7zgg5oSA= In-Reply-To: <0a492d77-0dfc-4efc-83b2-27698a0856f7n@googlegroups.com> Content-Language: en-US Xref: csiph.com comp.lang.java.help:4334 On 9/2/2020 1:36 AM, ashwin late wrote: Because you've posted the error messages but not the source code that provoked them, it's a little bit hard to see what you're trying to do. But from the fragments of source shown in the messages I can attempt a few guesses ... > Area.java:12: error: '(' expected > public void get Area(){ > ^ If this is an attempt to define a method named "get Area", the first problem is that names in Java cannot contain spaces: Spaces *separate* things, but cannot be part of them. Try squeezing out or replacing the space, arriving at "getArea" or "get_Area" or something of that nature ("getArea" is probably more idiomatic). The second problem is that a method name like "getArea" or "getPerimeter" or "getSomething" usually indicates that the method will return some information about its object. But yours is a "void" method, meaning it cannot return any value at all! That's not an error all by itself -- there's no RULE that says a method's name must describe its function -- but it's certainly an oddity. Ordinarily you would define the method to return a value of the appropriate type; for example, if the "area" of your object is a value of type "double" you might write public double getArea() { ... } > Area.java:13: error: ')' expected > system.out.println("Area ="+set Dim()); Again, the embedded space character is a no-no. Also, a method with a name like "setSomething" is usually expected to set a new value for some feature of its object, and that new value would usually be supplied as an argument: setDim(newDimensionValue) Sorry I can't give a more complete diagnosis, but I can only see a few tiny scattered bits of your Java code. -- esosman@comcast-dot-net.invalid When a witch hunt finds witches, pardon them. One hundred forty days to go.