Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created November 11, 2013 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/7409187 to your computer and use it in GitHub Desktop.
Save shigemk2/7409187 to your computer and use it in GitHub Desktop.
やさしいJava 13 pc
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