Channel Avatar

Geekific @UCXRZyv0cNwba6f0xCREAD_Q@youtube.com

30.5K subscribers - no pronouns set

What’s up fellow coders and welcome to Geekific! I’m Ed, a f


Geekific
8 hours ago - 4 likes

What will be the output of the following code?
--------------------
public static void main(String[] args) {
Pattern pattern = Pattern.compile("^([a-zA-Z]{4})(.*)([a-zA-Z]{9})$");
Matcher matcher = pattern.matcher("LikeAndSubscribe");
if (matcher.matches()) System.out.println(matcher.group(0));
}

Geekific
1 week ago - 13 likes

What will be the output of the following code?
--------------------
public static void main(String[] args) {
List<Integer> list = Stream.iterate(0, n -> n + 1)
.limit(30).skip(1)
.collect(Collectors.partitioningBy(number -> number % 2 == 0))
.get(true);
System.out.println(list.size());
}

Geekific
2 weeks ago - 14 likes

What will be the output of the following code?
--------------------
public static void main(String[] args) {
Stream.iterate(1, n -> n + 2)
.limit(8)
.skip(2)
.map(o -> o + " ")
.forEach(System.out::print);
}

Geekific
3 weeks ago - 10 likes

What will be the output of the following code?
--------------------
public static void main(String[] args) {
List<List<Integer>> list = List.of(List.of(10, 20, 30), List.of(40, 50, 60));
Integer result = list.stream()
.filter(l -> l.stream().reduce(0, Integer::sum) > 150)
.flatMap(Collection::stream)
.findAny().orElse(0);
System.out.println(result);
}

Geekific
4 weeks ago - 14 likes

What will be the output of the following code?
--------------------
public static void main(String[] args) {
System.out.println(getValue(1, 2, 3));
}
public static int getValue(int... values) {
return Arrays.stream(values).reduce(0, (a, b) -> a + getValue(b));
}
public static int getValue(int value) {
return (value + getValue());
}
public static int getValue() {
return 10;
}

Geekific
1 month ago - 8 likes

What will be the correct option regarding the following Java code snippet?
--------------------
interface ParentClass { }
class FirstChildClass implements ParentClass { }
class SecondChildClass implements ParentClass { }

Geekific
1 month ago - 13 likes

If a class inheriting an abstract class does not define all its methods, then it will be known as (we will be forced to make it)?

Geekific
1 month ago - 13 likes

What will be the output of the following code?
--------------------
public static void main(String[] args) {
int[] arr = {5, 2, 7, 1, 8};
Arrays.sort(arr, 1, 4);
System.out.println(Math.floorDiv(arr[0], arr[2]));
}

Geekific
1 month ago - 12 likes

What will be the output of the following code?
--------------------
public static void main(String[] args) {
String str = "Like and Subscribe";
System.out.print(str.replace("i", ".") + " | ");
System.out.print(str.replaceAll("i", "."));
}

Geekific
2 months ago - 17 likes

What will be the output of the following code?
--------------------
public static void main(String[] args) {
String str = "Geekific";
Arrays.sort(str.toCharArray());
StringBuilder reversed = new StringBuilder(str).reverse();
System.out.println(reversed);
}