Note that there are some explanatory texts on larger screens.

plurals
  1. POlogical error in this java code, how do i resolve this error?
    primarykey
    data
    text
    <pre><code>public class DogOwner extends Dog { public static void main(String[] args){ Dog dog1 = new Dog (); Dog dog2 = new Dog(); Dog dog3 = new Dog(); dog1.setLegs(4); dog1.setTail(true); dog3.setFur(" furry fur"); System.out.println("this dog has"+ dog1.GetLeg()+"legs"); System.out.println("does this dog have a tail?"+ dog2.Gettail()); System.out.println("this dog has"+ dog3.GetFur()); </code></pre> <p>} }</p> <p>} }<code>enter code here</code></p> <pre><code>enter code here public class Dog { /** variables**/ int Legs; boolean tail; String Fur; /** returns the Legs variable (getter) **/ public int GetLeg(){ return Legs; } /** stores method variable Llgs within variable legs (setter) **/ public void setLegs(int legs){ this.Legs=legs; } /** returns the tail variable (getter) **/ public boolean Gettail(){ return tail; } /** stores method variable tail within variable tail (setter) **/ public void setTail(boolean tail){ this.tail=tail; } /**because the void does not work with String data type, the type String * replaces void to make this code work (Hovercraft Full Of Eels, 2013) * Hovercraft Full Of Eels.2013.why is this code not working in Java?. * accessed from:http://stackoverflow.com/questions/20588830/why-is-this-code-not-working-in-java. * stockoverflow.com. [accessed: 14/12/2013]**/ public String GetFur(){ return Fur; } /**stores for the method variable within the parameter variable Fur **/ public void setFur(String fur){ this.Fur=fur; } } </code></pre> <p>the output that i wanted was: this dog has 4 legs,</p> <p>Does this dog have a tail? True,</p> <p>this dog has furry fur</p> <p>the text true should not be text and it should execute what the boolean value is, in this case it should execute true without the use of quoatation mark (hope this makes sense). im a beginner at Java and I can't seem to understand fully on how to code in java (or any programming language) using books. I require assistance from someone to fully understand coding. Also please explain how this code was resolved so I can understand the problem and how to resolve these types of problem in the future (hopefully).</p> <p>thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload