Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #30848 > unrolled thread
| Started by | s.senthilkumaran88@gmail.com |
|---|---|
| First post | 2015-01-24 19:55 -0800 |
| Last post | 2015-01-24 23:10 -0600 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.java.programmer
Difference between new instance() and new () in java s.senthilkumaran88@gmail.com - 2015-01-24 19:55 -0800
Re: Difference between new instance() and new () in java Leif Roar Moldskred <leifm@huldreskog.localdomain> - 2015-01-24 23:10 -0600
| From | s.senthilkumaran88@gmail.com |
|---|---|
| Date | 2015-01-24 19:55 -0800 |
| Subject | Difference between new instance() and new () in java |
| Message-ID | <bad1b40d-dd9c-4f26-a226-bc08f52819aa@googlegroups.com> |
Hi,
i have searched for difference between new intance() and new() in java.i am not getting any proper solution and real time prospectively.but i got only theoretical knowledge.can you anyone tell me what is the difference and which real scenario we used that two things.
what i am understanding in new insatnce() and new() :
new instance() :
It is used for run time and specified class loading like class.forname("FOO.class").newinstance();
new () :
It is used for compile time and as usual you know object creation like new FOO();
I don't know what is the exact difference for that.
Thanks
senthilkumaran
[toc] | [next] | [standalone]
| From | Leif Roar Moldskred <leifm@huldreskog.localdomain> |
|---|---|
| Date | 2015-01-24 23:10 -0600 |
| Message-ID | <r5qdnQgubrk151nJnZ2dnUVZ7omdnZ2d@giganews.com> |
| In reply to | #30848 |
s.senthilkumaran88@gmail.com wrote: > > > Hi, > > > i have searched for difference between new intance() and new() > in java.i am not getting any proper solution and real time > prospectively.but i got only theoretical knowledge.can you > anyone tell me what is the difference and which real scenario > we used that two things. > Short answer: if you don't know the difference, use /new/. Slightly longer answer: /newinstance()/ is a part of Java's reflection mechanism. Reflection is a way to analyze and manipulate the class system at runtime, which can be very useful in certain situations, but is not something you'll be likely to use in day-to-day coding. Put it aside for now and look back into it once you're familiar with the Java language. -- Leif Roar Moldskred
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web