Skip to content

Instantly share code, notes, and snippets.

@ishanbakshi
Created August 19, 2016 05:30
Show Gist options
  • Select an option

  • Save ishanbakshi/2ae5486cbdb2da1f9c8a6f0c7c23f44e to your computer and use it in GitHub Desktop.

Select an option

Save ishanbakshi/2ae5486cbdb2da1f9c8a6f0c7c23f44e to your computer and use it in GitHub Desktop.

Revisions

  1. ishan created this gist Aug 19, 2016.
    27 changes: 27 additions & 0 deletions StaticFunctionExample.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    /*
    * An example which shows how Static functions can be used in java
    * available on Url : http://goo.gl/l2OWUn
    */

    public class HelloWorld{

    public static void main(String []args){
    System.out.println("Start Function");
    Student st = new Student();
    st.name="oldName";
    System.out.println("name = "+ st.name);
    processor(st);
    System.out.println("name = "+ st.name);
    System.out.println("See how name changed. Static functions have static variables inside them. ;)");
    }

    public static void processor(Student st){
    st.name="newName";
    }
    }


    class Student{
    public String name;
    public int age;
    }