Hi;
How can me declare a Method in Java?
Thanks,mohsen
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
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
mohsendeveloper (June 11th, 2009)
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.
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(); } }
Please use [highlight=Java] code [/highlight] tags when posting your code.
Forum Tip: Add to peoples reputation by clicking the button on their useful posts.