View Khushi   Kumari 's Profile
If a class is located in a package, what do you need to change in the OS environment to be able to use it?
You need to add a directory or a jar file that contains the package directories to the CLASSPATH environment variable. Let's say a class Employee belongs to a package com.xyz.hr; and is located in the file c:devcomxyzhrEmployee.java. In this case, you'd need to add c:dev to the variable CLASSPATH. If this class contains the method main(), you could test it from a command prompt window as follows:
c:>java com.xyz.hr.Employee
Asked by Khushi Kumari | Sep 10 2018 | Report this Report abuse
Replies (4)
View Roshan  shah 's Profile
& apply to each bit of the variable, for example >> 0 & 1 (0000 & 0001 = 0000).
In our case when it compares
if(0001&null) results in NullPointerException .
Sep 17 2018 | Report this Report abuse
View Havish  Goswami 's Profile
& apply to each bit of the variable, for example >> 0 & 1 (0000 & 0001 = 0000).
In our case when it compares
if(0001&null) results in NullPointerException .
Sep 17 2018 | Report this Report abuse
View Tanya  Sharma 's Profile
What can go wrong if you replace && with & in the following code:
String a=null; if (a!=null && a.length()>10) {...}
Sep 17 2018 | Report this Report abuse
View Havish  Goswami 's Profile
A single ampersand here would lead to a NullPointerException.
Sep 17 2018 | Report this Report abuse