You don't have to declare stuff before using it, you can declare stuff as you use it. I'd suggest reading up a bit about java, but the idea is:
String tree = "Oak tree";
RS2Object tree = getObjects().closest(tree);
//... is functionally equivalent to
RS2Object tree = getObjects().closest("Oak tree");
//... likewise
Area area = new Area(0,0,0,0);
getWalking().walk(area);
//... is functionally equivalent to
getWalking().walk(new Area(0,0,0,0));