The keyword final has 3 uses.
1. It can be used to create the equivalent of a named constant.
2. It can be used to prevent method overriding. method overriding is one of Java’s most powerful features, there will be neccessity to prevent it from occurring. To disallow a method from being overridden, specify final as a modifier at the start of its declaration. Methods declared as final cannot be overridden.
3. It can be used to prevent inheritance. Sometimes you will want to prevent a class from being inherited. To do this, precede the class declaration with final. Declaring a class as final implicitly declares all of its methods as final, too.
Sunday, April 4, 2010
Choosing an approach between "extends Thread and implements Runnable"
The Thread class defines several methods that can be overridden by a derived class. Of these methods, the only one that must be overridden is run( ). This is, of course, the same method required when you implement Runnable. Many Java programmers feel that classes should be extended only when they are being enhanced or modified in
some way. So, if you will not be overriding any of Thread’s other methods, it is
probably best simply to implement Runnable. This is up to you, of course.
when you are going for multiple inheritance..the only interface can help, So creating thread class implements Runnable is best choice.
some way. So, if you will not be overriding any of Thread’s other methods, it is
probably best simply to implement Runnable. This is up to you, of course.
when you are going for multiple inheritance..the only interface can help, So creating thread class implements Runnable is best choice.
Hashtable Vs Hashmap -- Java Collection framework
1. Hashtable and Hashmap both provide key-value access to data.
2. The key difference between the two is that access to the Hashtable is synchronized while Hashmap is not synchronized. Hashtable performs better when you use a sequence of numbers as keys but can perform quite bad if the keys follow some special patterns while HashMap has an overall better performance in the real word and doesn't have "any" problems with special patterns.
3. The Hashtable is not part of the Java Collections Framework. But it does support all the API that a Collection interface specifies. Hashtable is what the Sun calls, the legacy collection implementation. Hashtable inherits from the Dictionary class which is obsolete in Java 1.6, while the HashMap inherits from collection interface “Map”.
4. Iterator in the HashMap is fail-safe where Hashtbale is not.
5. Hashtable is thread-safe. However there is a way of making Hashmaps thread safe using Collections.synchronizedMap(new Hashmap()).
6. HashMap permits one null key & more null values where Hashtable not permits null keys and values.
2. The key difference between the two is that access to the Hashtable is synchronized while Hashmap is not synchronized. Hashtable performs better when you use a sequence of numbers as keys but can perform quite bad if the keys follow some special patterns while HashMap has an overall better performance in the real word and doesn't have "any" problems with special patterns.
3. The Hashtable is not part of the Java Collections Framework. But it does support all the API that a Collection interface specifies. Hashtable is what the Sun calls, the legacy collection implementation. Hashtable inherits from the Dictionary class which is obsolete in Java 1.6, while the HashMap inherits from collection interface “Map”.
4. Iterator in the HashMap is fail-safe where Hashtbale is not.
5. Hashtable is thread-safe. However there is a way of making Hashmaps thread safe using Collections.synchronizedMap(new Hashmap()).
6. HashMap permits one null key & more null values where Hashtable not permits null keys and values.
Prevent USB access in windows -- B carefull
There are 2 cases we need to consider to prevent USB access
Case 1: If a USB storage device is already installed on the computer.
If a USB storage device is already installed on the computer, you can change the registry to make sure that the device does not work when the user connects to the computer. Important This task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article How to back up and restore the registry in Windows.
Follow these steps to set the Start value in the following registry key to 4 to prevent USB access:
1. Click Start, and then click Run. In the Open box, type regedit, and then click OK.
2. Locate and then click the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor
3. In the details pane, double-click Start.
4. In the Value data box, type 4, click Hexadecimal (if it is not already selected), and then click OK.
5. Exit Registry Editor.
Case 2 : If a USB storage device is not already installed on the computer
If a USB storage device is not already installed on the computer, assign the user or the group and the local SYSTEM account Deny permissions to the following files:
%SystemRoot%\Inf\Usbstor.pnf and %SystemRoot%\Inf\Usbstor.inf
Follow these steps:
1. Start Windows Explorer, and then locate the %SystemRoot%\Inf folder.
2. Right-click the Usbstor.pnf file, and then click Properties.
3. Click the Security tab.
4. In the Group or user names list, add the user or group that you want to set Deny permissions for.
5. In the Permissions for UserName or GroupName list, click to select the Deny check box next to Full Control.
Also add the System account to the Deny list.
6. In the Group or user names list, select the SYSTEM account.
7. In the Permissions for UserName or GroupName list, click to select the Deny check box next to Full Control, and then click OK.
8. Right-click the Usbstor.inf file, and then click Properties.
9. Click the Security tab.
10.In the Group or user names list, add the user or group that you want to set Deny permissions for.
11.In the Permissions for UserName or GroupName list, click to select the Deny check box next to Full Control.
12.In the Group or user names list, select the SYSTEM account.
13.In the Permissions for UserName or GroupName list, click to select the Deny check box next to Full Control, and then click OK.
Case 1: If a USB storage device is already installed on the computer.
If a USB storage device is already installed on the computer, you can change the registry to make sure that the device does not work when the user connects to the computer. Important This task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article How to back up and restore the registry in Windows.
Follow these steps to set the Start value in the following registry key to 4 to prevent USB access:
1. Click Start, and then click Run. In the Open box, type regedit, and then click OK.
2. Locate and then click the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor
3. In the details pane, double-click Start.
4. In the Value data box, type 4, click Hexadecimal (if it is not already selected), and then click OK.
5. Exit Registry Editor.
Case 2 : If a USB storage device is not already installed on the computer
If a USB storage device is not already installed on the computer, assign the user or the group and the local SYSTEM account Deny permissions to the following files:
%SystemRoot%\Inf\Usbstor.pnf and %SystemRoot%\Inf\Usbstor.inf
Follow these steps:
1. Start Windows Explorer, and then locate the %SystemRoot%\Inf folder.
2. Right-click the Usbstor.pnf file, and then click Properties.
3. Click the Security tab.
4. In the Group or user names list, add the user or group that you want to set Deny permissions for.
5. In the Permissions for UserName or GroupName list, click to select the Deny check box next to Full Control.
Also add the System account to the Deny list.
6. In the Group or user names list, select the SYSTEM account.
7. In the Permissions for UserName or GroupName list, click to select the Deny check box next to Full Control, and then click OK.
8. Right-click the Usbstor.inf file, and then click Properties.
9. Click the Security tab.
10.In the Group or user names list, add the user or group that you want to set Deny permissions for.
11.In the Permissions for UserName or GroupName list, click to select the Deny check box next to Full Control.
12.In the Group or user names list, select the SYSTEM account.
13.In the Permissions for UserName or GroupName list, click to select the Deny check box next to Full Control, and then click OK.
Note : We need to follow the same above steps to allow USB access ... All the best
Friday, April 2, 2010
CEEP 2010 Notification
Imp dates :
Start date for CEEP 2010 booklet selling : 23-03-2010
Last date for booklet submission : 30-04-2010
Examp date : 10-05-2010
Please check the notification details in CEEP 2010
Start date for CEEP 2010 booklet selling : 23-03-2010
Last date for booklet submission : 30-04-2010
Examp date : 10-05-2010
Please check the notification details in CEEP 2010
Subscribe to:
Comments (Atom)
