Just thought of what to do today and i came up with this simple java code that barks at me when i run it.

Mind you, considering the need for simplicity, the barking has being made in terms of words and not a sound format which is also achievable as might be posted in the future. Below is my code and feel free to make comments, add or subtract from it as you wish.

package com.tunji.dog;

class Dog{

int size;
String breed;
String name;
boolean healthy;

void bark(){
System.out.println(“ruff! ruff!!”);
}

class DogTest{  //this could be saved as another class.

public static void main(String[]args){
Dog c = new Dog();
c.size = 40;
c.breed = “bull”;
c.name = “coaster”;
c.healthy = true;
c.bark();

}
}

 

Regards.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s