Saturday, 13 February 2016

Basic Programs of core java

1) package java1;

public class firstjavaclass {

    public static void main(String[] args) {
  System.out.println("1st print");
int x=10; int y=20;

    }

}

O/P : 1st print

2) Concatination_Operator

public class Concatination_Operator {

    public static void main(String[] args) {
        String x = "Hello";
        String y = "3D";
        int a=100; int b=200; 
        System.out.println (x+y);
        System.out.println (x+y+a+b);
        System.out.println (a+b+x+y);
        System.out.println (x+y+(a+b));
    }

}

O/P : Hello3D
         Hello3D100200
         300Hello3D
         Hello3D300