
public static void main(String[] args) {
long number = 10000000000;
System.out.print(number);
}
Error:
java: integer number too large
Fix:
If you are dealing with numbers in your Java program and it gets too long! (over 2,147,483,647 to be precise) then it a type long and not int so you need to suffix the letter capital L or lower case l to fix the compilation error.
public static void main(String[] args) {
long number = 10000000000L;
System.out.print(number);
}
More Posts related to Java,
- How to install Java 11 on Mac
- Get Client IP address from HTTP Response in Java
- SharePoint Open in the client application document opens in browser
- How to verify if java is installed on the computer and get version detail
- Java - Check if array contains the value
- Your JBoss Application Server 7 is running However you have not yet added any users to be able to access the admin console
- How to run Java Unit Test cases with Apache Maven?
- What Java version is used for Minecraft 1.18
- List of jar files for Jax-ws (SOAP) based Java Web Services
- [Fix] Java Exception with Lambda - Cannot invoke because object is null
- Convert Instant timestamp into LocalDateTime Java Code Example
- Java - Calculate time taken for the code to execute in milliseconds or nanoseconds
- Create simple struts2 project using maven commands
- Java - PatternSyntaxException
- List of Online Java compiler with console
- Minecraft Java Edition
- How to declare and initialize Array in Java Programming
- [Solved] com.sun.xml.ws.transport.http.servlet.WSServletContextListener ClassNotFoundException
- Java XML-RPC 3.1.x based web service example
- Simple Struts 2 Tutorial in eclipse with tomcat 7 server
- Java 8 foreach loop code examples
- Java -Day of the week using Java 8 DayOfWeek Enum
- Java 8 - Convert List to Map Examples
- Java: TimeZone List with GMT/UTC Offset
- list of jars required for hibernate 4.x.x
More Posts:
- Android : Duplicate registration for activity com.example.abc - Android
- How to identify the version of IntelliJ - HowTos
- How to turn off autocomplete in input fields in HTML Form - Html
- How to create an Autocomplete Android EditText Example - Android
- How to open new tab in Sublime Text Editor [macOS] - MacOS
- How to run CMD console commands in Notepad++ - NotepadPlusPlus
- Center Align TextView Android Horizontally or Vertically - Android
- ModuleNotFoundError: No module named qdarkstyle.colorsystem [Python] - Python