Initialization of data field

Posted on 2005-04-13
Last Modified: 2010-05-18
Hi! all !!

I have this code below

private static final int NumberOfstudents = 20;

How do I Initialize the data filed so that NumberOfstudents is equal to 5 and is no longer a constant.

Thanks in Advance
Question by:ZURINET
    LVL 86

    Accepted Solution

    You need to remove final

    private static final int NumberOfstudents = 5;

    Author Comment

    Hi CEHJ

    it should be something like this ?

    private static int NumberOfstudents = 5;

    LVL 86

    Expert Comment

    :-) Yep

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    Title # Comments Views Activity
    countClumps  challenge 10 66
    JKS to store upstart data 2 50
    wordsCount challenge 10 49
    scoresSpecial  challenge 13 34
    By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
    Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
    Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now