「Java入門」staticメソッドを利用するサンプルコード

サンプルコード:
public class static_demo
{
String name;    //インスタンス変数
static String country = “Japan"; //クラス変数
public static void show()
{
System.out.println(country+"メソッド");
}
}
class Startnews24demo_static
{
public static void main(String[] args)
{
System.out.println(static_demo.country);
static_demo.show();
}
}

Java

Posted by arkgame