Q. How to find sum of Integer using For Loop?
SOLUTION:- package v1; import java.util.*; import java.util.Arrays; public class SumOfIntegerUsingForLoop { }
SOLUTION:- package v1; import java.util.*; import java.util.Arrays; public class SumOfIntegerUsingForLoop { }
SOLUTION:- import java.util.Arrays;import java.util.List; public class SumOfOddAndEven { public static void main(String[] args) { Integer[] number= {1,2,3,4,5,6,7,8,9,10}; List<Integer> list=Arrays.asList(number); // Even Nomber int sumOfEven=list.stream().filter(i->i%2==0).mapToInt(i->i).sum(); System.out.println(“Sum of Even numbers:”+sumOfEven); // Odd Number int sumOfOdd=list.stream().filter(i->i%2!=0).mapToInt(i->i).sum(); System.out.println(“Sum of Odd numbers:”+sumOfOdd); }}
Solution:- User.java package v1; public class User { } ************************************************************************* Test.java package v1; import java.util.ArrayList;import java.util.List; public class Test { } *************************************************************************
Ans:- s.No List Set 1. List allow duplicates Set does’t allow duplicates 2. The List is an ordered collection which maintains the insertion order. Whereas set is an unordered collection which does not preserve the insertion order. 3. The List …
JAVA is a programming Language and a platform. Java is a High Level, Robust, Secure programming language. It was developed by sun Microsystems in the year of 1995.James Gosling is known as father of java. before that its names was …
132 out of 164 Congress Won 39 out of 65 Bahujan Samaj Party 0 out of 0
Parties Total Seats Seats Won BJP 165 129 Congress 65 38 Bahujan Samaj Party 0 0