Java Stream API — Even Numbers (Full Screen) Java Stream API — Get Even Numbers Example 1 — Filter even numbers from a list Creates a list, uses Stream to filter evens, and prints them. Copy import java.util.*; import java.util.stream.*; public class EvenNumbersStream { public static void main(String[] args) { // Create a list of numbers List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); // Use Stream API to filter even numbers List<Integer> evenNumbers = numbers.stream() .filter(n -> n % 2 == 0) .collect(Collectors.toList()); // Print the even numbers System.out.println( "Even numbers: " + evenNumbers); } } Example 2 — Use IntStream.rangeClosed ...
OR Gate
- Introduction :- The OR Gate performs logical addition, commonly known as OR function. The OR Gate has two or more inputs and only one output. The operation of OR Gate is such that a HIGH (1) on the output is produced when any of the input is HIGH (1). The output is LOW (0) only when all the inputs are LOW (0).
- Logic Expression :- If A and B are the input variables of an OR Gate and Y is it's output, then,
- Truth-Table :-
- Logic Symbol of 2-input OR Gate :-
- OR Gate's IC-base diagram :-
- Apparatus :- Bread-board, LED-light, Battery(Power-Supply), IC-7432, Multimeter and Resistance.
- Procedure :- 1. Verify whether all the wires and components are in good condition.
- Experimental-data :-
- Precaution & discussion :- i> The continuity of the connecting terminals should be checked before going.
Y = A + B
Truth-Table of OR Gate
Logical symbol of 2-input OR Gate
OR-Gate's IC-base diagram
2. Set-up OR Gate circuit and feed all the input combinations.
3. Observe the output corresponding to input combinations and enter it in the Truth-Table.
ii> It should be care that the values of the components of the circuit is does not exceed to their ratings(Maximum value).
iii> Before, the circuit connecting, it should be check out, working condition of all the components.
Comments
Post a Comment