Created
November 11, 2013 07:19
-
-
Save shigemk2/7409187 to your computer and use it in GitHub Desktop.
やさしいJava 13 pc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pc; | |
// 車クラス | |
class Car | |
{ | |
private int num; | |
private double gas; | |
public Car() | |
{ | |
num = 0; | |
gas = 0.0; | |
System.out.println("車を作成しました"); | |
} | |
public void setCar(int n, double g) | |
{ | |
num = n; | |
gas = g; | |
System.out.println("ナンバーを"+num+"ガソリン量を"+gas+"にしました"); | |
} | |
public void show() | |
{ | |
System.out.println("車のナンバーは"+this.num+"です"); | |
System.out.println("ガソリン量は"+this.gas+"です"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment