How to convert a ArrayList into 2D array jn Java 7

I am trying to convert a Integer list in a 2D array in java 7. I first converted a String list to Integer and then Integer list to 2D array. Then I will do more operations as required.
What I tired is

List<String> list = Arrays.asList("1", "2", "3", "4");
    List<Integer> intList = new ArrayList<>();
    for (String s : list) {
    //the problem is from here
    int[][] array = new int[intList.size()][];
    for (int i = 0; i < list.size(); i++) {
        for (int j = 0; j < list.size(); j++) {
            array[i][j] = intList.get(j + (list.size() * i));

I tried solving my issue looking at this Converting an ArrayList into a 2D Array and this Convert ArrayList into 2D array containing varying lengths of arrays but majority of the answers are given in java 8 which I don’t want! i know its a basic problem but i am stuck! Can someone help me to fix this? Thanks in advance!

Go to Source
Author: Code Dexter

C++ array takes input more than its size

I used to know that arrays in c++ doesn’t elements more than specified only except resizable array or using dynamic memory allocation. But in the simple code below if I put a value in the 3rd or 4th index it compiles and runs without error, when I put value in 5th index it compiles fine but gives a runtime error and for the 6th index compiles and runs fine and it seem to go on like this randomly.

Is it some concepts I didnt know or I did something wrong?

#include <iostream>
using namespace std;

int main(){

    int arr[2]={2,2};

    arr[0] = 1;
    arr[1] = 2;
    arr[2] = 3;
    arr[4] = 4;
    arr[5] = 5; //gives a runtime error
    arr[6] = 6;


Go to Source
Author: Abdullah Al Nahian

finds the number of fans of each team and prints them in CSharp

I have this question about Arrays, the concept is really simple but the problem is I don’t know almost anything about Csharp, I am trying to help a friend who cant understand English very will, I told him how to solve the problem but without coding, can you help me write the code? also the question wasn’t in English, I tried to write it as clear as possible:
The fan.txt file contains the name and team information (GS, FB, or BJK).
by reading this information; The program that prints the names of the GS holders in the GS.txt file, the names of the FB holders in the FB.txt file, the names of the BJK holders in the BJK.txt file, and also finds the number of fans of each team and prints them on the form.
Sample file contents are below.

Go to Source
Author: flowery