System.out.println("Your name is "+name+" and you live in "+ home+" ,"+state +".");
}
Output:
If the user inputs name="Gaus",city="LosAngeles" and state="California"then the output will be "Your name is Gaus and you live in LosAngeless, California."
Explanation:
The above function is in java language which takes three argument names, state, and the city.
The name will be stored on the name variable of the string type.
The state will be stored on the state variable of string type.
The city will be stored on the city variable of the string type.
Then the Output will be displayed with the help of the print function.
Instance variables can be declared anywhere inside a class.
Although there isn't any rule to declare instance variables before methods, and they can be declared anywhere in the class, they cannot be declared inside method definitions of class.
<em>By convention class names begin with an uppercase letter, and method and variable names begin with a lowercase letter.</em> - True.
<em>Instance variables exist before methods are called on an object, while the methods are executing and after the methods complete execution.</em> - True.
<em>A class normally contains one or more methods that manipulate the instance variables that belong to particular objects of the class.</em> - True