Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Attributes,Modifieres, and More

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Attributes,Modifieres, and More

    This is what i have to do for an assignment:
    Create an animal class with at least 3 attributes and 2 methods. Write all possible accessor and modifier methods. Also write constructor for animal. This is what i have so far:

    public class Animal {
    static int cuteness;
    static boolean fur;
    static String name;



    public static void main (String agrs[]){
    Animal myAnimal = new Animal();
    getCuteness();
    getFur();
    getName();
    }
    public static void getCuteness(){
    System.out.println(cuteness);
    }
    public static void getFur(){
    System.out.println(fur);
    }
    public static void getName(){
    System.out.println(name);
    }
    }

    I'm guessing with what i am doing so can anyone please help me figure out how to do this assignment correctly. I'll appreciate any help


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Attributes,Modifieres, and More

    Please post your code in code or highlight tags. You can learn how in the Announcement topic at the top of most sub-forums.

    Go down the list of requirements in the assignment and check them off as you complete them. If you're not sure about a requirement - either what it means or how to do it - then ask specifically for help with that item.

Similar Threads

  1. how/where to add new method and attributes
    By me. in forum Java Theory & Questions
    Replies: 3
    Last Post: October 18th, 2012, 09:33 AM
  2. attributes and properties in jsp page
    By god1gracious in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: December 30th, 2011, 03:31 AM
  3. key with 2 attributes?
    By ober0330 in forum Collections and Generics
    Replies: 1
    Last Post: October 10th, 2011, 11:47 AM
  4. Get CSS Attributes using Java
    By justinmifsud in forum Object Oriented Programming
    Replies: 2
    Last Post: February 15th, 2011, 05:08 PM
  5. Cannot access class attributes
    By Cyburg in forum What's Wrong With My Code?
    Replies: 1
    Last Post: August 29th, 2010, 07:30 AM