This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I want to know why it prints 0. On the other hand if I type int l2 = l1*this.width after the declaration of int width, it prints 100 as expected. Please anyone give me a clear cut explanation of the above code. I appreciate your help.
You have not intitialized width before you use it. That's why width has default 0 value. If you place int width = 10; before int ll = l * this.width; , I think it should work.
Thanks for the reply. I know that I havn't initialized width before I use it. But I want to know why when said int ll = l * this.width; int width = 10; gives no error and when said int ll = l * width; //gives error here???why??? int width = 10; gives an error? Please clarify this.
Regards, Jothi Shankar Kumar. S
wise owen
Ranch Hand
Joined: Feb 02, 2006
Posts: 2023
posted
0
int ll = l * width; //gives error here???why??? int width = 10;