this: Cannot use this in static context

后端 未结 5 567
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-28 12:10

Can you please help me with below code. The error is: \"Cannot use This in a static context\"

public class Sample2 {
    /**
     * @param a         


        
5条回答
  •  天命终不由人
    2020-11-28 12:32

    If we try to access this from a static context , compiler has no way to guess which instance, you are referring too. main is a static method here.

提交回复
热议问题