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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:19:23+00:00 2026-05-30T06:19:23+00:00

I am trying to increment a variable from 0-99, and return the value each

  • 0

I am trying to increment a variable from 0-99, and return the value each time, but I’m unsure how i could do this. This is the code i have so far:

public int getValue()
{
  if (currentState == COUNTING)
  {
    for (int i = 0; i <= 99; i++)
    {
      value = i;
    }

    return value;      

  } else {
    return super.getValue();   
  }
} 

I’m not sure how I could modify this, as at the moment it is returning 99. I know why, but do not know how to accomplish what i am trying to do.

  • 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-05-30T06:19:25+00:00Added an answer on May 30, 2026 at 6:19 am

    Unfortunately, strictly speaking you cannot return multiple values from a method call. A method in Java can only return a single primitive value or Object..

    Your code returns 99 because the final ‘value’ of your loop variable ‘i’ is 99 when for loop finishes to execute. Instead you should try returning your values hold in an Integer Array.

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

Sidebar

Related Questions

I am trying to make a variable that I can increment each time after
I have a select statement that I am trying to loop over and increment
Trying to add an incremented class member variable 'nNodeIndex' to arraylist, but at the
I am trying to fade in div elements but for some reason every time
I'm trying to implement a method that will increment an NSDate instance variable by
Hi i am trying to increment a char in vb.net, eg: Dim letter As
I'm trying to get a JProgressBar to increment by 1 every 100th of a
I am trying a simple Extension Method example and am unable to increment or
I am trying to show by example that the prefix increment is more efficient
I'm trying to implement a jQuery slider with increments. I've gone from, the actual

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.