How do you write a property procedure in java?

I know that I would use something like this to get a property:

Code:
var myprop = 'my property string'

function getProperty(){
    getProperty = myprop;
}
but how do I set the property. At the moment I am using this:

Code:
var myprop = 'my property string'

function setProperty(newvalue){
    myprop = newvalue;
}

setProperty('this is the new value');
I don't want to have to do it this way. Is it not possible to do it like in vb, something like:

Code:
setProperty = 'this is the new value';