Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {

    public static void main(String[] args) throws Exception {

        String s1 = "java2s";
        String s2 = "java2s.com";
        String s3 = "Java2s.com";

        // returns the HashCode
        int ret1 = System.identityHashCode(s1);
        System.out.println(ret1);

        // returns different HashCode for same filename
        int ret2 = System.identityHashCode(s2);
        System.out.println(ret2);

        // returns the HashCode    
        int ret3 = System.identityHashCode(s3);
        System.out.println(ret3);
    }
}