How can i move between different methods with the same class. When i programmed in VB, it was just the name of the subroutine, but i cant figure it out in java. Please put me out of my misery

what do you mean "move between methods"?

You want to call one method from another? Check your textbook, see those braces?

Learn the language syntax and all will become clear, or at least clearer than it is now.

You use DOT notation (much like you do in VB I think.)

ClassInstanceName.MethodName(Optional parameters)

So if you have:

String myString = "Something";

// Then you could say:
System.out.println( myString.toUpper() );

'.toUpper' is a method of the String class that will output the string in upper case. :cool:

Opps, that was to call a method in a class.

Same way in VB. Use the method name. Just consider if you have a return value in the method, if so then you need to assign the return value to the same type.

Im still not sure. Heres the actual code

package animation;
import element.*;


public class Animation
{
public static void main (String args[])
{
int DrawingWindowWidth = 600, DrawingWindowHeight = 300;
ConsoleWindow c = new ConsoleWindow();
DrawingWindow d = new DrawingWindow(DrawingWindowWidth,DrawingWindowHeight);
//        Draw Environment



}


public static void DrawCraneKitbox (String args[])
{


}


}

im trying to call the DrawCraneKitbox method from within the main method.

Edited 3 Years Ago by happygeek: fixed formatting

Simple:

//Assuming you have a String Array (String args[]), lets call it:
String[] myStringArray = new String[2];

// And assuming you initilized myStringArray to somenting, you would have:
DrawCraneKitbox(myStringArray);

Since the Method was decalred as void, it has no return type. I would assume you want 'DrawCraneKitbox' to just do something. and then execute the next line of code.

This article has been dead for over six months. Start a new discussion instead.