Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

positive numbers in array

public class CountPositive {
    public static void main(String[] args) {
        double[] numbers = new double[4];
        numbers[0] = 1.7;
        numbers[1] = -1.9;
        numbers[2] = -5.7;
        numbers[3] = 6;
        for (int i = 0; i < numbers.length; i++) {
            if(numbers[i] > 0) {
                System.out.println(numbers[i] + " is Positive");
            }
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: Java Enum compareTo() 
Java :: android how to know when snackbar is done 
Java :: convert java code to kotlin online converter 
Java :: intent class for url and phone and others 
Java :: what is encapsulation in java 
Java :: default constructor 
Java :: how to create a java txt file from programm 
Java :: Java Hasmap Remove Elements 
Java :: Java Create a PrintWriter 
Java :: Exception handling using try...catch 
Java :: matrix dimensions 
Java :: find subarray with given sum 
Java :: java interview questions for freshers 
Java :: wrapper classes in java ebhor.com 
Java :: java meeting scheduler 
Java :: what does system.out.println(y + " ") result 
Java :: how to Compile the source code in ./src folder with libraries in ./lib folder using JavaSE-1.7 
Java :: reading 2d array in java 
Java :: empty map entry java 
Java :: Execute method on load alternative 
Java :: view binding 
Java :: sha-1 key generator 
Java :: layout focus from recycleview not from top in fragment inside nestedScrollview in android xml 
Java :: format string precision double java 
Java :: sha1 
Java :: Creating Hashmap from Treemap 
Java :: read only jtextfield 
Java :: scanner.nextInt stream api java 
Java :: jbutton scroll list full width size 
Java :: Add space to the left and right sides of a cell 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =