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 3 of 3

Thread: calling a method in class

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default calling a method in class

    main
    memclass memObject = new memclass();//this line wont work it has red lines under memclass

    error message
    constructor memclass in class home33.memclass cannot be applied to given types;
    required: java.lang.String,java.lang.String,java.lang.String ,java.lang.String
    found: no arguments
    reason: actual and formal argument lists differ in length
    ----
    (Alt-Enter shows hints)


    memclass
     
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package home33;
     
    /**
     *
     * @author ork
     */
    public class memclass {
     
        private String firstName;
        private String SecondName;
        private String joinDate;
        private String dob;
     
     
     
     
        public memclass(String firstName, String SecondNmae, String joinDate, String dob) {
            this.firstName = firstName;
            this.SecondName = SecondNmae;
            this.joinDate = joinDate;
            this.dob = dob;
        }
     
        public String getSecondNmae() {
            return SecondName;
        }
     
        public void setSecondNmae(String SecondNmae) {
            this.SecondName = SecondNmae;
        }
     
        public String getDob() {
            return dob;
        }
     
        public void setDob(String dob) {
            this.dob = dob;
        }
     
        public String getFirstName() {
            return firstName;
        }
     
        public void setFirstName(String firstName) {
            this.firstName = firstName;
        }
     
        public String getJoinDate() {
            return joinDate;
        }
     
        public void setJoinDate(String joinDate) {
            this.joinDate = joinDate;
        }
     
    }
    can anyone help please thanks the error is on the first line of code i included the class i am trying to call incase the error is there i have included netbeans error message
    Last edited by jps; October 31st, 2012 at 12:32 AM. Reason: code tags added


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: calling a method in class

    Did you bother to read the error message?
    What parameters does the memclass constructor expect?
    What parameters are you passing?
    The error message tells you!
    Improving the world one idiot at a time!

  3. #3
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: calling a method in class

    @MrBean
    Hi and welcome to the forum.
    Please see the announcements page for the use of code tags when posting code.

Similar Threads

  1. Calling method from .class file
    By alexx_88 in forum Java Theory & Questions
    Replies: 6
    Last Post: April 24th, 2012, 02:14 AM
  2. Calling a print method from another class (printing array)
    By Kaldanis in forum Object Oriented Programming
    Replies: 7
    Last Post: November 25th, 2011, 12:32 PM
  3. [SOLVED] method calling
    By javapenguin in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 4th, 2010, 01:43 AM
  4. Help Calling Method From Another Class
    By CheekySpoon in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 15th, 2010, 09:24 AM
  5. Calling a void method into a static void main within same class
    By sketch_flygirl in forum Object Oriented Programming
    Replies: 3
    Last Post: November 15th, 2009, 04:24 PM