Hi;
How can me declare a Method in Java?
Thanks,mohsen
Printable View
Hi;
How can me declare a Method in Java?
Thanks,mohsen
Hi Mohsen,
Welcome to java prog forums.
Heres a sample site for you:
Defining Methods (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
Cheers,
Truffy.
Hi,
you can use this as reference:
http://www.javaprogrammingforums.com...e-program.html
Hello mohsendeveloper, welcome to the Java Programming Forums.
Do you know about the main method? Declaring another method is basically the same. Here is an example for you.
Code :public class Mohsendeveloper { /** * JavaProgrammingForums.com */ public static void anotherMethod(){ // Here is another method we have declared // called anotherMethod. // This is printed when the method is called System.out.println("Thats how you declare a method"); } public static void main(String[] args) { // This is the main method and is the // starting point of an application. // You can call the anotherMethod method // like this: Mohsendeveloper m = new Mohsendeveloper(); m.anotherMethod(); } }