Scope of static variable and methods in Java

后端 未结 6 1277
自闭症患者
自闭症患者 2021-01-18 21:38

I have some doubts about usage of static method in Java. I read many places static variables are instance independent so be comes global.

public class ThirdC         


        
6条回答
  •  心在旅途
    2021-01-18 21:52

    You can Only execute one class at one time from the command line and in your program there are two classes which have main method if you run Second class at one time then it will not execute the main method of the Third class and vice versa. I have tested it on my system.

提交回复
热议问题