Tag: programming languages
Questions Related to programming languages
import java.util.regex.; class Regex2 { public static void main(String[] args) { Pattern p = Pattern.compile(args[0]); Matcher m = p.matcher(args[1]); boolean b = false; while(b = m.find()) { System.out.print(m.start() + m.group()); } } } And the command line: java Regex2 "\d" ab34ef
- import java.io.*; 4. class Vehicle { } 5. class Wheels { } 6. class Car extends Vehicle implements Serializable { } 7. class Ford extends Car { } 8. class Dodge extends Car { 9. Wheels w = new Wheels(); 10. } Instances of which class(es) can be serialized? (Choose all that apply.)
public static void main(String[] args) { // INSERT DECLARATION HERE for (int i = 0; i <= 10; i++) { List row = new ArrayList(); for (int j = 0; j <= 10; j++) row.add(i * j); table.add(row); } for (List row : table) System.out.println(row); } Which statements could be inserted at // INSERT DECLARATION HERE to allow this code to compile and run? (Choose all that apply.)
public static void before() { Set set = new TreeSet(); set.add("2"); set.add(3); set.add("1"); Iterator it = set.iterator(); while (it.hasNext()) System.out.print(it.next() + " "); }
- import java.util.*; 4. class Dog { int size; Dog(int s) { size = s; } } 5. public class FirstGrade { 6. public static void main(String[] args) { 7. TreeSet i = new TreeSet(); 8. TreeSet d = new TreeSet(); 9. 10. d.add(new Dog(1)); d.add(new Dog(2)); d.add(new Dog(1)); 11. i.add(1); i.add(2); i.add(1); 12. System.out.println(d.size() + " " + i.size()); 13. } 14. }
which of the following is mandatory for cobol program.