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: Cannot find symbol for constructor

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

    Default Cannot find symbol for constructor

     
    public class Monster {
     
    	private String name;
    	private String[] types;
    	private Move[] moveList = new Move[4]
     
     
    	public Monster (String name, String type) {	
    		this.name = name;
    		this.types = new String[]{type};
    	}
     
    	public Monster (String name, String type1, String type2) {
    		this.name= name;
    		this.types = new String[]{type1, type2};
    	}
     
     
    	public String getName() {
    		return this.name;
    	}
     
    	public Boolean hasType(String type) {
    		for (String item: this.types){
    			if (type.equals(item)){
    				return true;
    			}
    		}
    		return false;
    	}
     
    	public Move getMove(int index) {
    		return moveList[index];
    	}
     
    	public void setMove(int index, Move move) {
    		moveList[index] = move;
    	}
     
    	public String toString(){
    		return this.name + " (" + this.type1 + "): " + this.type2;
     
     
    }
     
    When I try to add strings into the monster constructor is comes back with symbol not found for monster

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Cannot find symbol for constructor

    Please copy the full text of the error message and paste it here. It should include the source line where the error happens.

    I do not see any symbol named: monster in the posted code. Java is case sensitive so monster is different from Monster.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. cannot find symbol
    By lanpan in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 1st, 2012, 08:13 AM
  2. Cannot find symbol
    By BadgerWatch in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 6th, 2011, 11:25 PM
  3. Cannot find Symbol?
    By defmetalhead in forum What's Wrong With My Code?
    Replies: 8
    Last Post: July 5th, 2011, 08:48 AM
  4. Cannot find symbol?
    By stealthmonkey in forum What's Wrong With My Code?
    Replies: 3
    Last Post: December 10th, 2010, 10:02 PM
  5. Replies: 2
    Last Post: November 3rd, 2009, 06:28 AM

Tags for this Thread