Answers for "java long int"

4

java long to int

public class LongToIntExample2{
      
    	public static void main(String args[]){
          
        	Long l= new Long(10);
        	int i=l.intValue();
        	System.out.println(i);
    	
        }
    }
Posted by: Guest on November-21-2020
1

long vs int java

An int is a 32-bit integer; a long is a 64-bit integer. Which one to use depends on how large the numbers are that you expect to work with.

int and long are primitive types, while Integer and Long are objects. 
  
  Primitive types are more efficient, but sometimes you need to use objects;
for example, Java's collection classes can only work with objects, 
so if you need a list of integers you have to make it a List<Integer>, for example (you can't use int in a List directly).
Posted by: Guest on August-15-2021
4

what is primitive data type in java

Primitive types are the most basic data types available within the Java language. There are 8: boolean , byte , char , short , int , long , float and double . These types serve as the building blocks of data manipulation in Java. Such types serve only one purpose — containing pure, simple values of a kind.
Posted by: Guest on May-26-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language