Q&A Discussions
[ANSWERED]Java visuals
0 Votes
1 AnswerWhy errors?
-1 Vote
2 AnswersNested methods
0 Votes
1 Answersomeone give me an example
0 Votes
1 AnswerWhats in the last space????
-2 Votes
3 AnswersWho speak spanish?
-4 Votes
2 AnswersYour app is broke
-2 Votes
3 AnswersPlease tell this program
0 Votes
1 AnswerStringBuffer
0 Votes
1 Answerstatic along with private
0 Votes
1 Answerpackage error
0 Votes
1 AnswerWhat is a Package ?
0 Votes
1 Answerpublic class Vehicle {
int maxSpeed;
int wheels;
String color;
double fuelCapacity;
void horn() {
System.out.println("Beep!");
}
}
class MyClass {
public static void main(String[ ] args) {
Vehicle v1 = new Vehicle();
Vehicle v2 = new Vehicle();
v1.color = "red";
v2.horn();
System.out.println(v1);
}
}
Explain its outcome. I am unable to get the last line of outcome.
-1 Vote
2 Answers