1. Engineering
  2. Computer Science
  3. what is the output of the following java program package...

Question: what is the output of the following java program package...

Question details

What is the output of the following Java program?

package test;

import java.util.*;

class Main {

public static void main(String[] argh) {

String s = "TGCAAGACGT";

int L = 3;

SortedSet mySet = new TreeSet();

for (int i = 0; i <= s.length() - L; i++) {

mySet.add(s.substring(i, i + L));

}

System.out.println(mySet.first());

System.out.println(mySet.last());

}

}

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution