What does private int mean in java?

Java

1 answer

Answer

1108035

2026-07-30 16:06

+ Follow

The private keyWord denotes that the field or method is hidden from view of any other class.

class MyClass {

private int n; // n cannot be accessed by any class except MyClass

private void doSomething(){} // doSomething cannot be accessed by any class except MyClass

}

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.