Tuesday, July 9, 2013

Educational content from Java Virtual Developer Day are online now

Watch educational content from Java Virtual Developer Day, covering Java SE, Java EE, and Java Embedded.

Visit https://oracle.6connex.com/portal/java2013/, register and enjoy the content.

Join this FREE virtual event where you will learn about:
  • HTML5 applications, improved developer productivity, and meeting enterprise demands using Java EE 7
  • What's new in Java that helps you begin programming on a wide range of embedded devicesWhat's new in Java that helps you begin programming on a wide range of embedded devices
  • Language improvements in Java SE to accelerate application development
Oracle Java 2013
Oracle Java 2013


Tuesday, July 2, 2013

Compare Strings in Java

Example of Comparing Strings in Java:

package javaex_cmpstring;

/**
 * @web http://java-buddy.blogspot.com/
 */
public class JavaEx_CmpString {
    
    String s1 = new String("java-buddy");
    String s2 = new String("java-buddy");
    String s3 = "java-buddy";
    String s4 = "java-buddy";
    String s5 = "java-" + "buddy";
    //s3, s4, and s5 will reference to the same object of "java-buddy"

    public static void main(String[] args) {
        new JavaEx_CmpString().CmpString();
    }
    
    private void CmpString(){
        System.out.println("s1==s2: " + String.valueOf(s1==s2));
        System.out.println("s3==s4: " + String.valueOf(s3==s4));
        System.out.println("s1==s3: " + String.valueOf(s1==s3));
        System.out.println("s3==s5: " + String.valueOf(s3==s5));
        
        System.out.println("s1.equals(s2): " + s1.equals(s2));
        System.out.println("s3.equals(s4): " + s3.equals(s4));
        System.out.println("s1.equals(s3): " + s1.equals(s3));
        System.out.println("s3.equals(s5): " + s3.equals(s5));
        
    }
}

Compare Strings in Java
Compare Strings in Java


Monday, July 1, 2013

Get offline API reference using "javac -Xprint"

http://docs.oracle.com/javase/7/docs/api/ provide API specification for the Java™ Platform, Standard Edition.

http://docs.oracle.com/javase/7/docs/api/
http://docs.oracle.com/javase/7/docs/api/
Alternatively, you can get API summary with the command "javac -Xprint".

example:
javac -Xprint java.nio.file.Paths


javac -Xprint java.nio.file.Paths
javac -Xprint java.nio.file.Paths