Click here to Skip to main content
15,892,965 members
Home / Discussions / Java
   

Java

 
AnswerRe: Username ,Password Validation Pin
chdboy24-Jul-13 22:02
chdboy24-Jul-13 22:02 
GeneralRe: Username ,Password Validation Pin
Richard MacCutchan24-Jul-13 22:20
mveRichard MacCutchan24-Jul-13 22:20 
GeneralRe: Username ,Password Validation Pin
chdboy25-Jul-13 4:04
chdboy25-Jul-13 4:04 
GeneralRe: Username ,Password Validation Pin
Richard MacCutchan25-Jul-13 4:47
mveRichard MacCutchan25-Jul-13 4:47 
GeneralRe: Username ,Password Validation Pin
chdboy25-Jul-13 5:01
chdboy25-Jul-13 5:01 
AnswerRe: Username ,Password Validation Pin
jschell24-Jul-13 9:48
jschell24-Jul-13 9:48 
GeneralRe: Username ,Password Validation Pin
chdboy24-Jul-13 22:28
chdboy24-Jul-13 22:28 
QuestionObject mutability Pin
Neo1010121-Jul-13 3:03
Neo1010121-Jul-13 3:03 
How would one mutate an object that is final? By referencing the object and then doing a mutate() operation on it? e.g.:
Java
final Object o = new Object(); 
o.mutate(); 


I don't understand. If it was declared final, then how come you are allowed to mutate it (or is that not true)?

How would one make the Object immutable then? Meaning: not mutable in any way, not even by reference.
How do I make sure a reference cannot modify the object it refers to? So that MyObject o = new Object(); o.modify(); is not possible?

I also read on Wikipedia the following example:
Java
final Position pos = new Position(); //pos is immutable 


members:
pos.x, pos.y, pos.z are mutable still, unless they are declared final.

So if I am understanding this correctly, in order to make an object/class completely immutable, everything in it including its reference has to be declared final? e.g.:

Java
final Position pos = new Position(); 

class Position { 
final int x; 
final int y; 
final int z;

public Position(){ 
x=1; 
y=2; 
z=3; 
} 

final void doA(){} 
final void doB(){} 
} 

AnswerRe: Object mutability Pin
Richard MacCutchan21-Jul-13 20:33
mveRichard MacCutchan21-Jul-13 20:33 
GeneralRe: Object mutability Pin
Neo1010122-Jul-13 0:32
Neo1010122-Jul-13 0:32 
GeneralRe: Object mutability Pin
Richard MacCutchan22-Jul-13 1:44
mveRichard MacCutchan22-Jul-13 1:44 
Questioncomplete spring example to get datasource from websphere Pin
swarjava20-Jul-13 7:03
swarjava20-Jul-13 7:03 
QuestionProblem Array and looping Ip address,How? Pin
tolulan18-Jul-13 23:37
tolulan18-Jul-13 23:37 
AnswerRe: Problem Array and looping Ip address,How? Pin
Richard MacCutchan18-Jul-13 23:57
mveRichard MacCutchan18-Jul-13 23:57 
GeneralRe: Problem Array and looping Ip address,How? Pin
terry.schoof25-Jul-13 10:31
professionalterry.schoof25-Jul-13 10:31 
GeneralRe: Problem Array and looping Ip address,How? Pin
Richard MacCutchan25-Jul-13 21:06
mveRichard MacCutchan25-Jul-13 21:06 
GeneralRe: Problem Array and looping Ip address,How? Pin
terry.schoof26-Jul-13 8:25
professionalterry.schoof26-Jul-13 8:25 
QuestionNeed help to capture signature on a tablet Pin
Mehwish Wajiuddin16-Jul-13 20:55
Mehwish Wajiuddin16-Jul-13 20:55 
Questionthe problem about when tomcat was installed as a NT service Pin
xiaobai137916-Jul-13 16:51
xiaobai137916-Jul-13 16:51 
AnswerRe: the problem about when tomcat was installed as a NT service Pin
jschell17-Jul-13 8:45
jschell17-Jul-13 8:45 
GeneralRe: the problem about when tomcat was installed as a NT service Pin
xiaobai137918-Jul-13 20:01
xiaobai137918-Jul-13 20:01 
QuestionTrying to understand Puzzle4..Head First Pin
Skytten15-Jul-13 7:00
Skytten15-Jul-13 7:00 
AnswerRe: Trying to understand Puzzle4..Head First Pin
Richard MacCutchan15-Jul-13 22:12
mveRichard MacCutchan15-Jul-13 22:12 
GeneralRe: Trying to understand Puzzle4..Head First Pin
Skytten16-Jul-13 0:02
Skytten16-Jul-13 0:02 
GeneralRe: Trying to understand Puzzle4..Head First Pin
Richard MacCutchan16-Jul-13 0:14
mveRichard MacCutchan16-Jul-13 0:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.