• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
Give examples of Java int, Integer and long data types?

What is long data type in Java?

What is long Max_value?

How do you compare long in Java?

What is the difference between long and integer?
by (9.7k points)  
edited by

8 Answers

0 votes

Java.Lang.Long class Defination:

The java.lang.Long class wraps an estimation of the crude kind long in an article. An object of sort Long contains a solitary field whose type is long. 

Long class is a wrapper class for the crude kind long which contains a few techniques to successfully manage a long worth like changing over it to a string portrayal, and the other way around. An object of Long class can hold a solitary long worth. 

A Long is a class, or a reference type, characterized in the standard library. It stores a reference to an article containing a worth (a "case"). 

The Long class wraps an estimation of the crude sort long in an item. An object of sort Long contains a solitary field whose type is long. 

What's more, this class gives a few strategies to changing over a long to a String and a String to a long, just as different constants and techniques helpful when managing a long. 

Long.parseLong(String): All the characters in the String must be digits with the exception of the principal character, which can be a digit or a less '- '. For instance – long var = Long.parseInt("- 123"); is permitted and the estimation of var after transformation would be - 123. 

Long wrapper class is utilized to make an item form of a crude long worth. 


Class Longs 



long myNum = 15000000000L; 


by (9.7k points)  
0 votes

Methods for JFrame:







by (9.7k points)  
0 votes



See Also:

Serialized Form

Field Summary
static longMAX_VALUE 
static longMIN_VALUE 
static ClassTYPE 


Constructor Summary
Long(long value) 
Long(String s) 

Methods inherited from class java.lang.Object
clone , finalize , getClass , notify , notifyAll , wait , wait , wait


by (9.7k points)  
0 votes
by (9.7k points)  
0 votes

Long Class


The wrapper for the primitive type long.

[Android.Runtime.Register("java/lang/Long", ApiSince=1, DoNotGenerateAcw=true)] public sealed class Long : Java.Lang.Number, IConvertible, IDisposable, Java.Lang.IComparable

by (9.7k points)  
0 votes

Convert int to Long Example in Java

  1. public class Sample2{  
  2. public static void main(String args[]){  
  3. int isx=100;  
  4. Long l= new Long(isx);//first way  
  5. Long l2=Long.valueOf(isx);//second way  
  6. System.out.println(l);  
  7. System.out.println(l2);  
  8. }}  
by (9.7k points)  
0 votes

Example methods of Long wrapper class

int compareTo(Long b)
boolean equals (Object ob)
static longparseLong(String s)
static Long valueOf(long b)
static Long valueOf(String s)
short shortValue()
Long byteValue()
int intValue()
long longValue()
float floatValue()
double doubleValue()
by (9.7k points)