Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Dont know how to change my main method

$
0
0
Im trying to copy a Method example from my book, but it does not give me the entire code. I know that my 5th line is wrong, but I don't know how to fix it.

import java.util.Scanner;

public class method {

	public static main(String [] args) {	
		int sum = 0;
		
		for (int i = 1; i <= 10; i++)
			sum += i;
		System.out.println("Sum from 1 to 10 is " + sum);
		
		return sum;
	}
}


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>