A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Java
»
Java in General
Author
What is the difference between int maxrows=20 and using Integer maxRows=new Integer(20);?
Sowm Herur
Ranch Hand
Joined: Jul 07, 2008
Posts: 32
posted
Oct 30, 2009 03:04:51
0
What is the difference between int maxrows=20 and using Integer maxRows=new Integer(20);?
Can we use int maxrows=20 to store maxrows instead of using Integer maxRows=new Integer(20);?
In what scenarios do we decide on what to use when?
Please Clarify
Leandro Coutinho
Ranch Hand
Joined: Mar 04, 2009
Posts: 415
posted
Oct 30, 2009 08:52:51
0
int x = 10; // x is primitive
Integer y = new Integer(10); // y is a reference to an object
Primitives can't invoke methods of its wrapper classes.
Primitives can't be null, while objects can.
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32654
4
posted
Oct 30, 2009 09:53:53
0
Closing as duplicate.
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: What is the difference between int maxrows=20 and using Integer maxRows=new Integer(20);?
Similar Threads
What is the difference between int maxrows=20 and using Integer maxRows=new Integer(20);?
Integer...
clarify my doubt
Primitive types
premitive types & Wrapper clases
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter