Q:

Trying to Solve Project's Euler's First Questions Using Java, Am Having Trouble Returning the Result

I am trying to make a program that solves Project Euler's First Problem. However I am having trouble returning my sum. 
To approach this problem, I am trying to first add up all of the multiples of three and assigning that value of the added multiples to the integer sum. Then I am trying to do the same with the multiples of five accordingly.
Finally I am trying to add the two sums together, the sum of the three multiples and the sum of the five multiples, and them printing out the coalesced value of the two sums via the last sum. 
This is the Java code I am trying to use to achieve this.

public class Main {

public static void main(String[] args) {

    int sum = 0;
    int t = 3;

    while (sum < 1000) {

        if (sum % 3 == 0)
            sum += t;

    }

    int sum2 = 0;
    int f = 5;

    while (sum2 < 1000) {

        if (sum % 5 == 0)
            sum += f;

    }

    int sum3 = sum + sum2;

    System.out.println(sum3);

}

}

I did get one error saying sum2 < 1000 is always true. However, I do not understand how to fix this problem. 
Any help is utterly appreciated. 

A:

check the comments, hope it helped.
 public static void main(String []args){

    int sum = 0;   //store all the numbers
    int t = 3;     // the starting point (it can be 3 if you want)

    while (t < 1000) {    // as long t is lower than 1000

       if ( t % 3 == 0 || t % 5 == 0) {    //check if t is divided by 3 or 5
         sum += t;             //add to sum
       }

       t++; //add 1 to t (t will increase and eventualy be bigger than 1000)
     }

     System.out.println(sum);  //print sum
  }

