What do you want to save?
Add Code snippet
New code examples
-
Java 2021-09-29 10:40:03
how to add a string parameter of an object in a List
import java.util.*; public class EShop { public static String name; public static Owner owner; public static User user; ArrayList<Item> itemsList = new ArrayList<Item>(); ArrayList<Buyer> buyersList = new ArrayList<... Add solution -
TypeScript 2021-09-28 23:06:03
reading multiple objects from file in java
FileInputStream fis = new FileInputStream("outputFile"); ArrayList<Object> objectsList = new ArrayList<>(); boolean cont = true; while (cont) { try (ObjectInputStream input = new ObjectInputStream(fis)) { Object obj = input.rea... Add solution -
Java 2021-09-27 05:04:02
Modify the existing ArrayList contents, by erasing the second element, then inserting 100 and 102 in the shown locations. Use ArrayList remove() and add() only. Sample output of below program with input 101 200 103: 100 101 102 103
import java.util.ArrayList; import java.util.Scanner; public class ArrayListADT { public static void printArrayList(ArrayList<Integer> numsList) { int i; for (i = 0; i < numsList.size(); ++i) { System.out.print(numsList.... Add solution -
Java 2021-09-24 16:25:01
java combine to byte[]
byte[] one = getBytesForOne(); byte[] two = getBytesForTwo(); List<Byte> list = new ArrayList<Byte>(Arrays.<Byte>asList(one)); list.addAll(Arrays.<Byte>asList(two)); byte[] combined = list.toArray(new byte[list.size()]); Add solution -
Java 2021-09-23 23:25:03
Polymorphisim
Polymorphism means objects behave in different forms. ■ It occurs when parent class/interface calls to child class' objects Sub class can never be the reference type of Super Class Object ■ The reference of an object decides what is accessible. ■ Abstr... Add solution -
Java 2021-09-19 05:17:02
how to reverse order of arraylist
ArrayList<Integer> arrlist = new ArrayList<Integer>(); //This is how to reverse arrlist's oringinal order. Collections.reverse(arrlist); //This is how to sort in a reverse order Collections.sort(arrlist, Collections.reverseOrder()); Add solution
Best helpers
Ranking is empty