2012-02-27から1日間の記事一覧

StudentTest

public class StudentTest { public static void main(String[] args) { /////////////////////////////// // Studentクラスを使う。 // 配列data作る。 /////////////////////////////// Student[] data = { new Student("結城浩", 65, 90, 100), new Stude…

Student

public class Student { //フィールド宣言 String name; // 氏名 int[] tens; // 試験の点数 フィールドtensの配列定義。 /////////////////////////////// //同じ名前のメソッドであっても引数違うので、 //違うメソッドとして扱われる。 /////////////////…

RectangleTest

//10-2 Rectangleのメインメソッド書いてみた。 public class RectangleTest{ public static void main(String[] args) { Rectangle data = new Rectangle(444,333); System.out.println(data); } } ///////////////////////////////////////// //以下、Rect…

Student

public class Student { //フィールド宣言 String name; // 氏名 int tens; // 試験の点数/////////////////////////////// //同じ名前のメソッドであっても引数違うので、 //違うメソッドとして扱われる。 /////////////////////////////// //Studentメソッ…

KamokuHeikin

public class KamokuHeikin { public static void main(String args) { // Kamokuクラス使う。 // 同じフォルダ内のKamoku.javaファイルも同時にコンパイルされる。 // Kamokuクラス内にて // public Kamoku(String namae, int tensuu) { // と宣言してるの…

Kamoku this.namae = na;// namae = na 

public class Kamoku { //フィールド決めて。 //フィールドは変数ですよ。 String namae; // 科目名 namaeフィールド int tensuu; // 点数 // コンストラクタ // フィールドの詳細です。 // String namae と String na を区別してみよう。 public Kamoku(Str…

Kamoku フィールド コンストラクタ  this toString()

public class Kamoku { //フィールド決めて。 String namae; // 科目名 int tensuu; // 点数 // コンストラクタ // フィールドの詳細です。 public Kamoku(String namae, int tensuu) { this.namae = namae; this.tensuu = tensuu; } // 科目の文字列表現 //…