String str declared twice - gives error in compile time