Methods : Accessing from outer Classes (Part 3)
In the last tutorials , we learned about accessing methods within the class using static keyword. Now we will learn how to access methods from outside the class i.e other classes. Accessing methods outside the Class Till now we used to declare methods and call them in the same class , that is why we used static keyword . static means method of main class. eg:- public class MyClass { static void start () { System.out.println(" Machine Starting ! "); } public static void main(String args[]) { start (); } } //Outputs Machine Starting ! Here we declared and called a method in the class MyClass . For accessing methods from outer class , we should first create objects of it and then access them.If you are not through with creating objects , visit Objects page. Here ( . ) keyword is used to access methods or variables of a class i.e" object . method/variable" class OtherClass { void sta...