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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:17:15+00:00 2026-06-09T02:17:15+00:00

i’m a new here. I’m try to do a message list, with the content

  • 0

i’m a new here.
I’m try to do a message list, with the content of Message 1, Message 2 & Message 3.
But code below shows error message.

static final String[] ITEMS = new String[] { "message 1", "message 2", "message 3" };

error message:

Illegal modifier for parameter ITEMS; only final is permitted

however in “ANOTHER PROJECT”, i’m doing a fruit list, using code below.

static final String[] FRUITS = new String[] { "Apple", "Banana", "Coconut" };

and it works perfectly fine. Both codes look exactly the same, so i have no idea where the problems.

below is the complete codes for the message list.

package net.eg.itemlist;


import android.os.Bundle;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.app.ListActivity;

public class Main extends ListActivity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    static final String[] ITEMS = new String[] { "message 1", "message 2", "message 3" };

    ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(this, R.layout.main, R.id.textview_id, ITEMS);
    setListAdapter(adapter);            


}
}
  • 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-09T02:17:17+00:00Added an answer on June 9, 2026 at 2:17 am

    You cannot use static within a Method. Move the declaration up to the class-level or remove the static.

    static means it is a value of the class itself rather than of an instance of the class. So if you create 100 instances of your class there is only one shared instance of this variable if you declare it static, however there would be 100 instances if you don’t declare it static.

    In Java this kind of variable is only allowed at class-level.

    As a side note: In C++ (not sure about C) you could use it inside of methods/functions with a similar semantic: the memory of that variable will be the same each time you call the function/method and the initialization will only be done on the first call. But you cannot address the memory from outside the function/method, thus the variable will be “function/method-private”.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I want to count how many characters a certain string has in PHP, but
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim

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.