Help... dont know what's the problem.. accessing another class

(im new to java =c)
well i have a file named accessfiles.java as my main page and i have another java file named try1.java
i can access try1.java from accessfiles.java using a simple case..... but how come i cant return to accessfiles.java?
is it with the string[]args?? do i have to erase it?
please help me =c
accessfiles.java
import java.io.*;
public class accessfiles{
public static void main(String[]args)throws Exception{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("\nMAIN MENU");
System.out.println("[1] for Prelim MP1");
System.out.print("CHOICE: ");
switch(c)
case 1:
     try m1=new try1();
     m1.try();
     break;
default: System.out.println("Invalid Input!");
     break;
try1.java
import java.io.*;
public class try1 {
     public static void try()throws Exception
          BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
          int x=0;
          int y=0;                    
          int r=0;
     System.out.println("1st Pattern");
     for (x=1;x<=5;x++)
     System.out.println(" ");
     r=x;
     for (y=1;y<=r;y++)
     System.out.print(y);
     System.out.println(" ");
     System.out.println(" ");
     System.out.println("2nd Pattern");
     for (x=5;x>=1;x--)
     System.out.println(" ");
     r=x;
     for (y=1;y<=r;y++)
     System.out.print(y);
accessfiles m2=new accessfiles();
     m2.main();
     break;
}

For starters, you don't seem to understand the difference between a static and non-static method. Here is an example of how to call a method in a different class.
public class MainClass {
    public static void main(String[] args) {
        MainClass app = new MainClass();
        app.go();
    public void go() {
        System.out.println("start of go");
        another.method();
        System.out.println("end of go");
    private AnotherClass another = new AnotherClass();
public class AnotherClass {
    public void method() {
        System.out.println("method");
}

Similar Messages

Maybe you are looking for