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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:32:48+00:00 2026-05-22T20:32:48+00:00

Is there a loop in java that executes multiple methods (or multiple actions) at

  • 0

Is there a loop in java that executes multiple methods (or multiple actions) at the same time?

Example:

replace(line1, line2);
replace(line3, line4);
replace(line5, line6);
replace(line7, line8);
replace(line9, line10);

Loop through a file and replace the strings – they aren’t in order.

  • 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-22T20:32:49+00:00Added an answer on May 22, 2026 at 8:32 pm

    Regarding this code in your question’s edit:

    replace(line1, line2);
    replace(line3, line4);
    replace(line5, line6);
    replace(line7, line8);
    replace(line9, line10);
    

    You simply need one method, replace, called by a for or while loop (depending if you know in advance how many times you’ll loop). If this doesn’t solve your problem, then (again), please ask a better and clearer question.

    There’s no need to use threads to do these all at the same time. You state that “I only need to do this once”, perhaps, but you need to call replace at least 5 times in this example, so actually a loop that calls replace 5 times passing in different parameters would work nicely. If you had an array of pairs of lines, you could loop through the array with a for loop calling replace as you loop. Again there’s no need for a “do together” here but rather a “do in order”.

    But again you seem to be withholding critical information for unknown reasons. Again, I urge you to study this link: How To Ask Questions The Smart Way

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

Sidebar

Related Questions

Is there a way in Java's for-each loop for(String s : stringArray) { doSomethingWith(s);
I noticed that the startup time of a minimal console application in Java is
I'm writing a daemon in Java that takes in requests from multiple providers in
I'd like to write a java while loop that will iterate for 15 seconds.
I have a Java program that executes specific commands into the OS. Am also
I have a class that implements the Enumeration<T> interface, but Java's foreach loop requires
Is there a way to control the optimization level of the java compiler that
Is there any alternative in Java that may correspond to foreach{} available in other
There's a loop where we get certain data. Depending on the data, file writer
find whether there is a loop in a linked list. Do you have other

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.