Integer.parseInt("4") == Integer.parseInt("04")
That is it. You can convert a numeric string into integer using Integer.parseInt(String)
method, which returns an int
type. And then comparison is same as 4 == 4
.
More Related Contents:
- Java Array storing objects with multiple fields
- Initialization of an ArrayList in one line
- Java socket API: How to tell if a connection has been closed?
- Connecting to remote URL which requires authentication using Java
- Calling method from constructor
- Java 8’s streams: why parallel stream is slower?
- Best way to encode text data for XML in Java?
- Why can’t primitive data types be “null” in Java?
- java: “final” System.out, System.in and System.err?
- Where are compiled JSP Java (*__jsp.java) files?
- Barcode Scanner implementation on Java [closed]
- Refreshing GUI by another thread in java (swing)
- How do I correctly use custom renderers to paint specific cells in a JTable?
- Java command line with external .jar
- Why catch Exceptions in Java, when you can catch Throwables?
- How do I create a Stream of regex matches?
- What do F and D mean at the end of numeric literals?
- In Java Swing how do you get a Win32 window handle (hwnd) reference to a window?
- How to get a JavaDoc of a method at run time?
- ArrayList.remove is not working in a loop
- Netbeans – Build targetting JDK 6 but run using Java 7 JRE
- TestSuite Setup in jUnit 4
- How to add action listener that listens to multiple buttons
- Checking if a collection is empty in Java: which is the best method?
- Exception in thread “main” java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)
- EJB’s – when to use Remote and/or local interfaces?
- In Java, how to append a string more efficiently? [duplicate]
- Hibernate: CRUD Generic DAO
- How to select the Date Picker In Selenium WebDriver
- Does Apache Commons HttpClient support GZIP?