CodesJava

Easy learning with example program codes

what are non access modifiers in java?


static: It is used to represent the class members. It can be used with variable, method, initializer block and nested class.

final: It is used to restrict the further modification of instance variables, local variables , methods and classes.

abstract: abstract is used with class or method which must be enhanced or modified further.

synchronized: It is used to achieve thread safeness. It controls mutual exclusive problem in multithreading environment. Only one thread can access a resource at a particular instance of time. When a thread accesses a synchronized block or method, it acquires a lock on it and release the lock either after completion of method/block or any exception occur.

Java interview questions on access modifiers

Sign Up/ Sign In
Ask a Question


Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki