1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Looking for a good Java Programmer

Discussion in 'Programming & Webmastering' started by Wastedslayer, Mar 17, 2009.

  1. Wastedslayer

    Wastedslayer

    Joined:
    Dec 7, 2005
    Messages:
    832 (0.26/day)
    Thanks Received:
    31
    Basically for my class I need to make 3 files:

    P04
    P04Cylinder
    P04CylinderInterface

    P04Cylinder Implements P04CylinderInterface

    and then P04 is your main()

    my issue is I was sick when we covered interfaces, so I am so lost its not even funny!

    If you want to speak with me Id hope to do it over AIM or something we can Im with because I need my issue fixed rather quickly, I have the files made im Just receiving a compiling error, I dont mind sending you the files.

    AIM is Wastedslyr and my email is wastedslayer@gmail.com

    Hit me back,
    Mike
  2. Oliver_FF

    Oliver_FF New Member

    Joined:
    Oct 15, 2006
    Messages:
    546 (0.19/day)
    Thanks Received:
    65
    In a small nutshell:

    1. A Java Interface is a class that just contains empty definitions of methods.
    2. Any number of classes can "implement" an interface class.
    3. Every class that does "implement" an interface class MUST contain methods that override those listed in the interface.
    4. In P04 you can create objects of static type "P04CylinderInterface". You can instantiate it to any class that implements that interface.

    Code:
    public interface P04CylinderInterface {
        public String giveMeText();
    }
    
    Code:
    public class P04Cylinder implements P04CylinderInterface {
        public String giveMeText() {
            return "TEXT!!";
        }
    }
    
    Code:
    public class P04  {
        public static void main(string[] args){
            P04CylinderInterface p;
            p = new P04Cylinder();
            System.out.println(p.giveMeText());
        }
    }
    
    Give that a go, i'd try it but it's late and i've got work tomorrow. Good luck :)
  3. mrw1986

    mrw1986

    Joined:
    May 4, 2007
    Messages:
    2,111 (0.79/day)
    Thanks Received:
    338
    Location:
    Wallingford, CT
  4. bail_w

    Joined:
    Apr 7, 2009
    Messages:
    140 (0.07/day)
    Thanks Received:
    8
    How about you post your codes and the errors here then we will see what is your problem.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page