Posts

Function Overloading

Image
 function overloading happens two or more function with the same name   with different parameters or arguments  fun(34); fun("hello"); static void sum(int a){ System.out.println(a) } static void sum(String a){ System.out.println(a); } At compile time it's decide which function to take  no of argument should be different or no of type should be different 

Scoping and Variablelength Arruguments

Image
 public class HelloWorld{      public static void main(String []args){         System.out.println("Hello World"); int b = 200;       sum();      }      static void sum(){          int a  = 100;                    System.out.println(a);      } } function scoping jasa ya sum() wala method ka under hum b ko access nahi kar sakta because wo function scope ka bahar haa  sum(){ }  Block level scope { } public class HelloWorld{      public static void main(String []args){         System.out.println("Hello World")         {             int c = 100;         }         System.out.println(c);      } } asa karana ga toa error aya ga because hum block ka bhar c ko print karwana ke koshis kar raha haa error  will  be symbol not found  public class HelloWorld{      public static void main(String []args){         System.out.println("Hello World");                       String a = "bip";              {           a = "soniya";       }                    

First java Program

Image
 every  thing is class like  file ka name .java sa save hota haa jo je ake class haa class Main{ } java par bhi  Capital letter sa start ho vo Class ka under ata haa  class ka matlab name,group of properties and function class are know as method  Scanner jo haa onput lana ka lia  System.in    ka matlab haa keybord sa input lana ka lia  Type Casting :- 

Function/Method in Java

 public class HelloWorld{      public static void main(String []args){       sum();      }    static void sum(){          System.out.println("hello world");      } } public class HelloWorld{      public static void main(String []args){         System.out.println("Hello World");                  int a = sum();         System.out.println(a);      }     static int sum(){         return 20;     } }

Intro to Java

Image
 

Flow of Program

Image