Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package taskone;
- import java.util.*;
- class Arrayplus1 {
- int x;
- int data[];
- void example(int x) {
- this.x = x+1;
- this.data= new int[x];
- }
- void increaseSizeOfArray(int incrementSize) {
- int copiedArray[] = Arrays.copyOf(data, data.length + incrementSize);
- data = copiedArray;
- }
- void printall() {
- System.out.println(Arrays.toString(data));
- }
- }
- public class TaskOne {
- public static void main(String[] args) {
- example task = new example();
- task.printall();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement