![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
![]() |

|
| Programming tutorials All Knowledge Info and links to posted here |
![]() |
|
Java: Information Hiding
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Administrator
Posts: 876
Join Date: Oct 2005
Rep Power: 10
IM:
|
For example: // Default int i = 0; //public public int i = 0; Public: When you declare a variable public it means that it can be accessed anywhere in the program. If you inherit from that class you would have access to all of the public variables. Private: When a variable is private it cannot be seen anywhere except for the class is instantiated in. If you use a class you will not be able to see any private data. Protected: If a variable is protected you only have package access (useful when developing libs). That means that you will only see the variable in the package that it is instantiated in and all its subclasses. Default: Default package access is achieved when there is no specifier (private, public, or protected). Default package access means that the variable is available within the package that it is created in but not in the package subclasses. Basically you can think of it as a package private. When creating variables within a method you can only specify one keyword (final). You cannot create public, private, or protected, or even default variables. When you create an Object within a method it is only available within the method it is created in. |
|
|
|
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Java JDBC Tutorials - Topics include Java, Database, JDBC, Driver, ODBC and more! | Anilrgowda | Graphic tutorials | 0 | 04-Sep-2007 01:02 AM |
| There's a Memory Diagnostic Tool Hiding On Your Vista DVD | Iphone | Microsoft windows vista error | 0 | 06-May-2007 11:08 PM |
| The Javalog.txt file is created in the Windows\Java folder when Java logging is enabl | Anilrgowda | Microsoft windows vista error | 0 | 29-Jan-2007 10:09 AM |
| Stop Hiding Inactive Notification Area Icons | Anilrgowda | Microsoft Windows xp error | 0 | 16-Dec-2006 10:08 AM |
| Hiding Your Sensitive Data From Google and the World | Admin | Google Optimization | 0 | 05-Dec-2006 12:22 AM |