One_class - Another_class.print_it(23); /* Another way to...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* Written to illustrate how to call a static method which is in some other class. */ public class One_class { public static void main(String [] args) { Another_class x, y, z; /* The difference between static and non-static counters. */ x= new Another_class("Ex "); y= new Another_class("Wye "); z= new Another_class("Zed "); x= new Another_class("Another Ex "); x= new Another_class("One more Ex"); /* One way to call the static method print_it: */
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Another_class.print_it(23); /* Another way to call print_it. */ /* To use x.print_it(24), x must be initialized: */ x.print_it(24); /* If I try something like this: * * print_it(25); * * I get the following error message: * * One_class.java:17: cannot resolve symbol * symbol : method print_it (int) * location: class One_class * print_it(25); * ^ * 1 error */ } }...
View Full Document

Ask a homework question - tutors are online