Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8858413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:49:24+00:00 2026-06-14T14:49:24+00:00

Let’s just get down to business. I have this line of code: public static

  • 0

Let’s just get down to business. I have this line of code:

    public static Tile[] tiles = new Tile[400];

which is giving me the following error in eclipse

    Syntax error on token ";", { expected after this token

Tile is a class in the same project and package of which I want to make an array because I can’t think of any other way to do the things in the rest of the program…

I have looked on google and on stackoverflow, but can’t find the answer. Could someone explain to me what I am doing wrong?

Thanks in advance,
Dirk.

EDIT: Here is the Tile class:

    package com.mrdls.invade;

    public class Tile {

        public String name = "";
        public int id = 0;
        public boolean passable = false;

        public Tile(String name, int id){
            this.name = name;
            this.id = id;

            if(name == "air"){
                passable = true;
            }
        }
    }

EDIT2, here is the TilesBlocks class

    package com.mrdls.invade;

    import java.awt.image.BufferedImage;

    import javax.imageio.ImageIO;

    public class TilesBlocks {

        public static BufferedImage tilesetBlocks;

        public static int pixelsPerTile = 20;

        public int[] ints = new int[20];

        public Tile[] tiles = new Tile[400];

        tiles[0] = new Tile("air", -1);
        /*public static final Tile earth = new Tile("earth", 0);
        public static final Tile stone = new Tile("stone", 1);
        public static final Tile cobblestone = new Tile("cobblestone", 2);
        public static final Tile sand = new Tile("sand", 3);
            public static final Tile sandstone = new Tile("sandstone", 4);
        public static final Tile grass = new Tile("grass", 5);
        public static final Tile woodLog = new Tile("log", 6);
        public static final Tile leaves = new Tile("leaves", 7);
        public static final Tile pumpkin = new Tile("pumpkin", 8);
        public static final Tile melon = new Tile("melon", 9);
        public static final Tile pumpkinCarved = new Tile("carved pumpkid", 10);

        public static final Tile copperOre = new Tile("copper ore", 20);
        public static final Tile tinOre = new Tile("tin ore", 21);
        public static final Tile ironOre = new Tile("iron ore", 22);
        public static final Tile silverOre = new Tile("silver ore", 23);
        public static final Tile goldOre = new Tile("gold ore", 24);

        public static final Tile diamondOre = new Tile("diamond ore", 40);
        public static final Tile emeraldOre = new Tile("emerald ore", 41);
        public static final Tile rubyOre = new Tile("ruby ore", 42);
        public static final Tile sapphireOre = new Tile("sapphire ore", 43);*/

        public TilesBlocks(){
            try{
                TilesBlocks.tilesetBlocks = ImageIO.read(Tile.class.getResourceAsStream("/tileset_terrain.png"));
            }catch(Exception e){

            }
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:49:25+00:00Added an answer on June 14, 2026 at 2:49 pm
            tiles[0] = new Tile("air", -1);
    

    You can’t do this in your class. You need to assign it in your constructor.
    Read the difference between initialization and assignment.

    Initialization of field belongs outside a method, but of course is encapsulated by a class.

    Assignment belongs in a method.

    or you can initialize like so:

    Tiles []tiles = new Tiles[]{new Tile("air",-1)} ;
    

    And use .equals not ==

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have this code: <p dataname=description> Hello this is a description. <a
Let's say I have a sortable list like this: $(.song-list).sortable({ handle : '.pos_handle', axis
Let's say I have a string like this: var str = /abcd/efgh/ijkl/xxx-1/xxx-2; How do
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Let's say I have some text as follows: do this, do that, then this,
Let's say I have the following entity: public class Store { public List<Product> Products
Let's suppose that we have multi-site CMS and every website in this CMS having
Let's say I have the following classes : public class MyProductCode { private String
Let's suppose I have an XML file like this: <?xml version=1.0 encoding=ISO-8859-1?> <MIDIFile> <Event>
Let's say on a page I have alot of this repeated: <div class=entry> <h4>Magic:</h4>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.