Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

public class Dog {
private int weight;
public int getweight(){
return weight;
}
public void SetWeight(int newWeight){
if (newWeight > 0){
weight = newWeight;
}
}
}




public class TestDog {

public static void main(String[] args) {
Dog d = new Dog();
System.out.println("Dog d's weight is " + d.getWeight());
d.setWeight(42);
System.out.println("Dog d's weight is " + d.getWeight());
d.setweight(-42);
System.out.println("Dog d's weight is " + d.getWeight());
}
}


class dog is compiled but there is an error in class
TestDog when compiled and the error is with dot notations. I
want to kmow why there is error in testdog class when compiled.

Answer Posted / madan

This piece of code will not generate an error surely even
with the dot notations. if you got errors post the
description of that error here

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we need new date and time api in java se 8?

969


How can I protect myself? : java security

1062


What is a static method?

1073


What about products that claim to detect malicious applets? : java security

873


Is it better to learn java or python?

997


What is a uint8?

1053


can anyone tell me what kind of questions are asked for core java exam in aptech

1917


In java thread programming, which method is a must implementation for all threads?

1075


What are messages in java?

1042


Is java an api?

971


What is flatmap in java8?

1034


What is meant by framework in java?

1105


Explain daemon thread.

1025


Which class is the superclass of every class?

1065


What is class forname java?

973