package mobile;
import java.util.*;
/**
 *
 * @author user
 */
public class Mobile {

    /**
     * @param args the command line arguments
     */


public static void main(String[] args) {

    int[][] data = new int[10][10];

    data = timesTable(10,10);
    Scanner scan = new Scanner(System.in);

    System.out.print("Enter Row:");
    int row2 = scan.nextInt();
    System.out.println("");
    System.out.print("Enter Column:");
    int column2 = scan.nextInt();

    for (int row = 0; row < data.length ; row++)
    {
        for (int column = 0; column < data[row].length; column++)
        {
            System.out.printf("%2d ",data[row][column]);
        }
        System.out.println();

    }
}

public static int[][] timesTable(int r, int c)
{
     int [][] yes = new int[r][c];

    for (int row = 0; row < yes.length ; row++)
    {
        for (int column = 0; column < yes[row].length; column++)
        {
            yes[row][column] = (row+1)*(column+1);
        }

    }
    return yes;
}

}

can some one tell me how i can call the data's of row2 and column2 and insert them onto "int [][] yes = new int[r][c];" replacing the value of r and c respectively.
`

so .. basically, you need to know how to call a method ?

int[][] data2 = new int[row2][column2];

make sure to add this line after you've initialized both values.

im not really good at java so i mostly use this. but is doest seem to work since im using a static variable and in not really sure how to use getter and setter.

you can't use the this keyword here, because the this keyword points to the current instance, while you don't have an actual instance.

also: static members shouldn't be called through an instance, but through the class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.