Link Search Menu Expand Document

Forbidden Features

In general, once a class has been discussed, it is available for use by students. (For example, once the String class is introduced, you may assume that you can call any of the available String methods in future programming assignments without asking permission). Unless otherwise specified, language features should not be used before they have been introduced in class (e.g. you should not use if statements in any assignment until you have seen them in class). Students should realize, however, that saying that you are not forbidden from using a certain construct is not the same thing as saying that it is a good idea to use a certain construct. We generally don't give advice to students about which constructs to use; you should use your best judgment to decide. (Though if a particular assignment states that you are required to use a construct, you should do so.)

In addition, there are some constructs that you are NEVER allowed to use, as described below. Java has grown to be a complex language with many features, and we don't have time to teach all of these features in CSE 142. We have a general rule that students should not use "advanced" material that we have not covered in class. In addition, we have identified several Java features that we do not want students to use at all. It is not bad style to use these features, but we want to have a level playing field for all students. Since we don't teach these features in the class, we do not allow them to be used to avoid giving an advantage to students who have learned about the features on their own.

The following features should NEVER be used in any graded CSE142 work (unless otherwise specified by the assignment or problem):

  • return from a void method, break, continue
  • the System.exit method
  • switch statements
  • try, catch, and annotations
  • the <> operator
  • the var keyword
  • the String methods toCharArray, join, and matches
  • StringBuilder, StringBuffer, StringJoiner, and StringTokenizer classes
  • Arrays.asList, Arrays.copyOf, Arrays.copyOfRange, and Arrays.sort
  • toArray and clone methods of ArrayList
  • Collections.copy, Collections.sort
  • multi-dimensional arrays
  • Java 8 features, such as lambdas, streams, and method references
  • Java 11 features, such as local variable type inference