Network interface details with Java 6

EthernetMany times it is useful to be able to get programmatically information about the network interfaces present on a host. Java standard library include a number of classes designed to provide access to this information. The most important is java.net.NetworkInterface which suffered a major face lifting in Java 6. (more…)

Getting file system details in Java

HDDue to a number of differences between various platforms it is very difficult to present system specific information in a consistent manner. When getting closer to system specific details, like file system information, a Java programmer has to become aware of the operating system hosting his program in order to make sense of the information returned by some of the Java APIs. Getting detailed information about a file system in Java is pretty difficult without using system specific code like JNI or at least accessing various specific operating system resources like configuration files. (more…)

Displaying a splash image with Java 6

SplatIntroduced in Java 6 is the option of displaying a splash screen when an application starts. The splash image file can be specified on the command line with the new splash option -splash:splash.jpg or in the manifest of a jar file with the SplashScreen-Image option. (more…)

Anonymous Inner Classes

AnonymousAn anonymous class in Java is a class with no specified name declared and instantiated at the same time. Because it has no name it can only be used once at place of declaration. Anonymous classes implement an interface or extend a class. They cannot declare their own constructors (they don’t have a name known to the programmer) so the constructor used for instantiation is one inherited from the superclass. (more…)

Local Inner Classes

BoatLocal inner classes are declared inside of a block of code. This block can be static bloc, a constructor, a method or simply a block of code surrounded with curly braces. These classes are only visible inside the enclosing bloc, but inside the block full hierarchies of classes can be developed. Local inner classes can implement any interface or extend any class as long as those are visible and extendable. On the other hand interfaces cannot be declared in a local scope. (more…)

Inner Classes

BubbleAn inner class is a class declared inside another class. The enclosing class can be a top level class or another inner class. The reason for using inner classes is to properly implement composition when the life of inner class instances are controlled by the outer class instance. Since the inner class instances are always linked to a specific outer class instance, usually the outer class instance manages the inner class instances and controls their life cycle. (more…)

Static Nested Interfaces

PumpkinA nested interface is just a regular interface defined inside another class or interface. They are actually defined inside the body of the parent class, not only in the same file. The feature is useful for grouping related interfaces and for encapsulating interfaces in the classes where they are used.
(more…)

  • Calendar

    May 2012
    M T W T F S S
    « Sep    
     123456
    78910111213
    14151617181920
    21222324252627
    28293031  
  • License

    • Creative Commons License