Tip Bank

DevX

Setting Proxy in Java Code

The java.net package contains classes that deal with connections across the network. If there is a direct connection to the Internet via a modem, various classes like the HttpConnection or

DevX

Print a Stack

If you have a line in your code you are trying to debug or you don’t know how you got there, or where you came from (who called it), you

DevX

Avoiding Unnecessary Catch Blocks

The result of adding unnecessary catch blocks is code like this, where exceptions are caught and then immediately re-thrown: try { // some code here } catch (Exception e) {

DevX

Retrieve a Parent Directory From a Path

You can retrieve the parent directory from a path by identifying the first and last backslash. The start position for the first backslash should be 3 in order for it