Answers for "how to get both string and integer in java"

2

string a int java

String number = "1"
int num = Integer.parseInt (name);
//num equals 1
Posted by: Guest on May-12-2020
0

java convert string to int and compare

Collections.sort(data, new Comparator<TXCartData>() {
        @Override
        public int compare(TXCartData lhs, TXCartData rhs) {
            int n1=Integer.parseInt(lhs.rowId);
            int n2=Integer.parseInt(rhs.rowId);
            if (n1>=n2){
                return 1;
            }
            return -1;
        }
    });
Posted by: Guest on April-18-2021

Code answers related to "how to get both string and integer in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language