Skip to Main Content

Java User Groups

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to subtract from the total length of an array

Gayathri VenugopalFeb 23 2019 — edited Feb 24 2019

I have an array named shop which has a length of 10. char shop[][] = new char[10][10] so my shop.length is 10 if (colshop ==  9) In the above line, I have hard-coded the value to be 9, Instead, I want to subtract 1 from shop.length. If I do if (colshop == (shop.length - 1)) ,it is not working.Please be patient as I am new to java. How do I do it so that I get the value of 9 as i do not want to hard code the value 9

Comments

Post Details

Added on Feb 23 2019
1 comment
175 views