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 8663091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:53:49+00:00 2026-06-12T16:53:49+00:00

Just a simple class calls a class that prints an array. I get a

  • 0

Just a simple class calls a class that prints an array. I get a syntax error in Eclipse. I also get an error that I don’t have a method called Kremalation.

public class AytiMain {

    public static void main(String[] args) {
        AytiMain.Kremalation();
    }
}

public class Kremalation {

    String[] ena = { "PEINAW", "PEINOUSA", "PETHAINW" };
    int i; // <= syntax error on token ";", { expected after this token

    for (i = 0; i <= ena.lenght; i++)
        System.out.println(ena[i]);
}
}
  • 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-12T16:53:50+00:00Added an answer on June 12, 2026 at 4:53 pm

    You have code (which is not declaring a variable and/or initializing it) ouside a method, which is:

    for (i=0; i<=ena.lenght; i++)
        System.out.println(ena[i]);
    

    In Java, code MUST reside inside a method. You can’t call a class, you have to call a method that is declared inside a class.

    WRONG:

    class ClassName {
       for (...) 
    }
    

    CORRECT:

    class ClassName {
      static void method() {
        for (...)
      }
    
      public static void main(String[] args) {
        ClassName.method();
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So i have a class name repository which is just a simple array.Here is
If I have a Customer class that just has simple properties (e.g. Name ,
I wrote simple class that on the start it just increase the value of
I just can't get the ajax service to work. A simple class to $.get(http://google.com)
I have a Service class with a method called GetProducts(). That encapsulates business logic
Just a simple question: if I had a simple vector class: class Vector {
I was making a simple class for a small project and decided to just
I've created a simple class and got a little problem: I just want to
I've a very simple class which has one integer variable. I just print the
I'm doing this with a very simple class, just to learn, but I'm not

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.