programming

Cards (94)

  • Java is a class-based, object-oriented programming language.
  • The "finally" block in Java's exception handling guarantees execution of code whether an exception occurs or not.
  • In Java, the "int []" keyword is used to declare an array.
  • Trying to access an array element with an index that is out of bounds in Java results in a run-time error.
  • Multiple exceptions can be handled in a single catch block in Java using a single catch block with multiple exception types separated by "|".
  • The default value for an uninitialized element in a numeric array in Java is 0.
  • FileNotFoundException is a checked exception in Java.
  • All exceptions in Java, including checked exceptions, are handled by the "Throwable" class.
  • The "Throwable" class is the base class for all exceptions in Java.
  • Recursion in Java is a method calling itself.
  • The base case in a recursive function is the initial condition that stops the recursion.
  • In a recursive function, the stack is used to keep track of method calls and their parameters.
  • The main advantage of using recursion in Java is its simplicity and readability of code.
  • If a recursive function lacks a base case, it results in infinite recursion.
  • In Java, the term "indirect recursion" is used to describe a recursive function that calls itself indirectly through another function.
  • Tail recursion in Java is a recursive function where the recursive call is the last operation.
  • Any iterative solution can be converted to a recursive solution.
  • Memoization in the context of recursion involves storing the results of expensive function calls and returning the cached result.
  • Divide and conquer is a type of recursion that involves solving a problem by dividing it into subproblems of the same type.
  • A regular expression in Java is a pattern that defines a set of strings.
  • The "Pattern" class in Java is used to work with regular expressions.
  • In Java regular expressions, the "\d" pattern represents any digit.
  • The "matches()" method of the Matcher class in Java checks if the entire input sequence matches the pattern.
  • In Java regular expressions, the "/" character is used to escape metacharacters.
  • The "split()" method in Java's String class when used with regular expressions splits a string into an array of substrings based on a specified delimiter.
  • The purpose of the "finally" block in Java's exception handling is to guarantee execution of code whether an exception occurs or not
  • In Java, the keyword used to declare an array is "array"
  • If you try to access an array element with an index that is out of bounds, it will result in a run-time error
  • To handle multiple exceptions in a single catch block in Java, you can use a single catch block with multiple exception types separated by "|"
  • The default value for an uninitialized element in a numeric array in Java is 0
  • FileNotFoundException is a checked exception in Java
  • You can iterate over all elements of an array in Java using a for loop with an index, a for-each loop, or a while loop
  • The keyword used to throw a user-defined exception in Java is "throw"
  • The output of the code int[] numbers = new int[5]; System.out.println(numbers[2]); will be 0
  • The base class for all exceptions in Java is Exception
  • In Java, recursion is a method calling itself
  • The base case in a recursive function is the initial condition that stops the recursion
  • In a recursive function, the stack is used to keep track of method calls and their parameters
  • The main advantage of using recursion in Java is the simplicity and readability of code
  • If a recursive function lacks a base case, it will result in infinite recursion