What are different types of access modifiers?

Answer Posted / shekhar suchak

private:it can be access within the block or we can aslo say that within the class.

public:"every where,any where" just one line ans.

protected:it can be access within package and outside of package.but there should be inheritense.

default:it will be access within the package.

class can not be private and protected.its only default and public.we dont have to mention 'default' keywords it always be there,but invisible.

Thanks & Regards

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why does java have different data types for integers and floating-point values?

519


You can create a string object as string str = “abc”; why cant a button object be created as button bt = “abc”;? Explain

514


Does list allow duplicates in java?

503


When a lot of changes are required in data, which one should be a preference to be used? String or stringbuffer?

742


What are thread safe functions?

499






What is a stringbuffer?

498


How are java objects passed to a method and what are native methods?

581


What is function and method in java?

512


When the constructor of a class is invoked?

574


What the difference is between execute, execute Query, execute Update?

359


How can you say java is object oriented?

579


What is hash table in java?

484


How much is a java license?

511


What is a stringbuilder?

493


What is balanced tree in java?

518