Java - Interview Questions and Answers for 'Aqua equities' | Search Java Interview Question -

Search Java Interview Questions

 2158 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text


Interview Questions and Answers for 'Aqua equities' - 1 question(s) found - Order By Newest

 Q1. Write a Program to add 1-100, 101-200, 201-300 in different threads and then sum the numbers ?Core Java2016-11-30 20:51:58

Ans. public class TotalUsingThreads extends Thread{
   private static List<TotalUsingThreads> collector = new ArrayList<TotalUsingThreads>();
   private int startFrom = 0;
   private Integer threadTotal = null;
   Test(int startFrom){
      this.startFrom = startFrom;
   public static void main(String[] args) throws InterruptedException{
      int totalSum = 0;
      // Create all the threads and set the count starting point for all of them
      for(int count=0;count<10;count++){
         TotalUsingThreads newThread = new TotalUsingThreads(count*100);
      boolean allCollected = false;
      // Make sure that all thread totals are collected and all threads have completed their tasks
         for(int count=0;count<10;count++){
            if(collector.get(count).threadTotal == null){
         allCollected = true;
      // sum totals of all threads
      for(int count=0;count<10;count++){
         totalSum += collector.get(count).threadTotal;
   public void run(){
      threadTotal = 0;
      for(int count=startFrom;count<startFrom+100;count++){
       threadTotal += count;   

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     coding  code  threads  multithreading     AQUA Equities

Related Questions

  What are the steps to be performed while coding Junit with Mocking framework ?
  What is a Sequence File?
 What different level of logging you use while coding ?

Subscribe to Java News and Posts. Get latest updates and posts on Java from
Enter your email address:
Delivered by FeedBurner

comments powered by Disqus

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked:

X Close this

1 person from Ashburn are looking for questions for 'Aqua equities'. Connect with them to better prepare for your interview.
X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   

Questions Asked: