PHP <--> Java class conversion Part 1
Convert this tiny php class to adequate java one.
init($val);
$this->doSomething();
}
private function init($val)
{
$this->var1 = $val;
}
private function doSomething()
{
$this->var2 = sqrt($this->var1);
}
public function getResult()
{
return $this->var2;
}
}
?>
public class Foo
{
private double var1;
private double var2;
public Foo(double val)
{
init(val);
doSomething();
}
private void init(double val)
{
var1 = val;
}
private void doSomething()
{
var2 = Math.sqrt(var1);
}
public double getResult()
{
return var2;
}
}