Java入門–finalクラス(class)の使い方

Javaコード
package com.startnews24.itdemo;
class Sample {
String name;
int a;

void m() {
System.out.println(“m() function is called");
}

}
final class Daiwa {
int i = 5, j = 7;
Sample cf = new Sample();

void g() {
System.out.println(“g() function is called");
}

}
public class DemoClas {
public static void main(String[] args) {
Daiwa obj=new Daiwa();
obj.g();
obj.i=40;
obj.j++;

}

}

実行結果

g() function is called

Java

Posted by arkgame