Advertisement
AkanthaAnil

OCA: Adding new StringBuilder + list.size( )

Jul 19th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. public class Test {
  2.      public static void main(String[] args) {
  3.          List<StringBuilder> days = new ArrayList<>();
  4.          days.add(new StringBuilder("Sunday"));
  5.          days.add(new StringBuilder("Monday"));
  6.          days.add(new StringBuilder("Tuesday"));
  7.  
  8.          if(days.contains(new StringBuilder("Sunday"))) {
  9.              days.add(new StringBuilder("Wednesday"));
  10.          }
  11.  
  12.          System.out.println(days.size());
  13.      }
  14.  
  15. //What is the output?
  16.  
  17. 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement