package javazuoye; import java.util.Scanner; //import org.omg.Messaging.SyncScopeHelper; public class lianjia { public static void main(String[] args) { // TODO Auto-generated method stub text ae = new text(); ae.method(); } } class text{ public void text(){ } int sum = 0; void method(){ Scanner kbInput = new Scanner(System.in); kbInput.useDelimiter("\s"); while(kbInput.hasNextInt()){ int nextValue = kbInput.nextInt(); sum += nextValue; } kbInput.close(); System.out.printf("sum:%d",sum); } }