1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Anestetic [448]
4 years ago
5

Why is an array like a list? How do you identify and find elements in an array? Explain the purpose of a try-catch block and giv

e an example. (Intro-to-Java)
Computers and Technology
1 answer:
viktelen [127]4 years ago
8 0

Answer:

Java supports creation and manipulation of arrays, as a data structure. The index of an array is an integer value that has value in interval [0, n-1], where n is the size of the array. If a request for a negative or an index greater than or equal to size of array is made, then the JAVA throws a ArrayIndexOutOfBounds Exception. This is unlike C/C++ where no index of bound check is done.

The ArrayIndexOutOfBoundsException is a Runtime Exception thrown only at runtime. The Java Compiler does not check for this error during the compilation of a program.

Explanation:

You might be interested in
Write the following function without using the C++ string class or any functions in the standard library, including strlen(). Yo
dolphi86 [110]

Answer:

The function in C++ is as follows

int chkInd(string str1, string str2){    

int lenstr1=0;

while(str1[lenstr1] != '\0'){  lenstr1++;  }

int index = 0; int retIndex=0;

for(int i=lenstr1-1;i>=0; i--){

   while (str2[index] != '\0'){

       if (str1[i] == str2[index]){

           retIndex=1;

           break;         }

       else{   retIndex=0;      }

  index++;    }

  if (retIndex == 0){   return i;   }else{return -1;}}

}

Explanation:

This defines the function

int chkInd(string str1, string str2){    

First, the length of str1 is initialized to 0

int lenstr1=0;

The following loop then calculates the length of str1

while(str1[lenstr1] != '\0'){  lenstr1++;  }

This initializes the current index and the returned index to 0

int index = 0; int retIndex=0;

This iterates through str1

for(int i=lenstr1-1;i>=0; i--){

This loop is repeated while there are characters in str2

   while (str2[index] != '\0'){

If current element of str2 and str1 are the same

       if (str1[i] == str2[index]){

Set the returned index to 1

           retIndex=1;

Then exit the loop

           break;         }

If otherwise, set the returned index to 0

       else{   retIndex=0;      }

Increase index by 1

  index++;    }

This returns the calculated returned index; if no matching is found, it returns -1

  if (retIndex == 0){   return i;   }else{return -1;}}

}

4 0
3 years ago
How many nibbles are in 18 bytes??
IgorC [24]
36 Nibbles are in 18bytes.
7 0
4 years ago
HELP ASAP!! WILL MARK BRAINLIEST
lesya692 [45]

Answer:20*i

Explanation:

Because the size will expand as its being written out to then have i

4 0
3 years ago
What is best method for modern businesses to authorize the use of workplace resources to its employees
Reika [66]
<span>Assign them a user authentication and password.</span>
3 0
3 years ago
Read 2 more answers
What is the protocol in the web search at the bottom?
klasskru [66]
(D) HTTP, or hyper-text transfer protocol, is the standard or set of rules that governs how web pages are sent over the internet.
3 0
3 years ago
Other questions:
  • ASAP PLZ!!!!!! Type the correct answer in the box. Spell all words correctly What are the steps of moving data into a data wareh
    9·1 answer
  • A company wishes to move all of its services and applications to a cloud provider but wants to maintain full control of the depl
    7·1 answer
  • The company currently runs 60 autonomous APs and has plans to increase wireless density by 50% in the near future
    13·1 answer
  • Why were american colonists unhappy with king george iii?
    6·2 answers
  • A common use-case for dictionaries is to store word counts. Let's modify our program below to store the count for each unique wo
    9·1 answer
  • What is an important fact about databases?
    7·1 answer
  • Who wrote the book of luke​
    7·1 answer
  • What are real online jobs any one of any age can get pays weekly by Pay<br> Pal
    8·1 answer
  • Write a class definition line and a one line docstring for the class Dog. Write an __init__ method for the class Dog that gives
    11·1 answer
  • Data erasure software uses standards that are called.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!