

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Solution: Static methods may be called without instantiating an object. Therefore, an instance variable may not have an assigned value when a static method is ...
Typology: Exercises
1 / 3
This page cannot be seen from the preview
Don't miss anything!


public double average ( int num1 , int num2 ) { return ( num1 + num2 ) / 2.0; }
public double average ( int num1 , int num2 , int num3 ) { return ( num1 + num2 + num3 ) / 3.0; }
public double average ( int num1 , int num2 , int num3 , int num4 ) { return ( num1 + num2 + num3 + num4 ) / 4.0; }
COMP1102/8702 Computer Programming 1, CHM & LJS
public String multiConcat ( String text , int count ) { String result = text ; if ( count > 1) for ( int i = 2; i <= count ; i ++) result += text ; return result ; }
public String multiConcat ( String text ) { return text + text ; }
public interface Visible { public boolean makeVisible (); public boolean makeInvisible (); }
public interface Breakable { public void break (); public boolean broken (); }
COMP1102/8702 Computer Programming 1, CHM & LJS