Advertisement
Guest User

Untitled

a guest
Oct 7th, 2015
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. I didn't read the assignment but I can give you some basic code which you can finetune:
  2.  
  3. char[] array1 = {'h','e','l','l','o','!'};
  4. char[] array2 = {'h','e','l','l','o'};
  5. boolean areEqual = false;
  6.  
  7. if(array1.length == array2.length){
  8. for(int i = 0; i < array1.length; i++){
  9. if(array1[i] != array2[i]){
  10. break; //stop the for loop, continues at the next comment
  11. }
  12. if(i == array1.length-1){
  13. areEqual = 1;
  14. }
  15. }
  16. //And by next comment I mean this one
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement