java - Is it possible to throw ArrayIndexOutOfBoundsException? -


  सार्वजनिक शून्य पर onClick (int पंक्ति) {if (mItems.size () & lt; = row) {return; } कार्रवाई कार्रवाई = एमआईटीम्स.टेट (पंक्ति); }  

क्या mItems.get () को कॉल करना सुरक्षित है?

संपादित करें: क्रैश लॉग से, पंक्ति -1 है, और फिर अपवाद फेंक दें।

संपादित करें: सुरक्षित लेखन है:

  यदि (पंक्ति & lt; 0 || पंक्ति & gt; = mItems.size ()) {.. ।}  

अगर सवाल है, क्या यह कोड एक ArrayIndexOutOfBoundsException फेंकता है

यदि कोई नकारात्मक मान पंक्ति में पारित हो जाता है, तो यह कोड java.lang.ArrayIndexOutOfBoundsException


Comments

Popular posts from this blog

c# - Highlight all words containing a letter in a richtextbox -

uislider - In a MATLAB GUI, how does one implement a continuously varying slider from a GUIDE created .m file? -

Editing Python Class in Shell and SQLAlchemy -