Click here to watch in Youtube :
https://www.youtube.com/watch?v=q1yPqx3HB4o&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java Class Methods or Static Methods |
public class ClassMethodTest { public static void main(String[] args) { ClassMethodTest.display("Hello"); ClassMethodTest classMethodTest = new ClassMethodTest(); /* * You can also refer to static methods with an object reference like * below. but this is discouraged because it does not make it clear that * they are class methods. */ classMethodTest.display("Peter"); } /* * Static methods, which have the static modifier in their declarations, * should be invoked with the class name, without the need for creating an * instance of the class. */ public static void display(String str) { System.out.println(str); } }
Hello Peter
https://sites.google.com/site/javaee4321/java/ClassMethodDemoApp.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ClassMethodDemoApp
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/14218d6dfc0ba96c475ae9bea5112ff3ce747d04/BasicJava/ClassMethodDemoApp/?at=master
See also:
No comments:
Post a Comment