📄 matriks2.java
字号:
// matriks2.java
// matriks
import javax.swing.*;
public class matriks2
{
public static String output;
public static void main (String args[])
{
int A[][] = {{1,2}, {3,4}} ; //declare reference to an array
int B[][] = {{5,6}, {7,8}} ; //declare reference to an array
JTextArea outputArea = new JTextArea() ;
output = "Elemen Matriks A:";
genOutput(A);
output += "Elemen Matriks B:";
genOutput(B);
outputArea.setText( output );
JOptionPane.showMessageDialog( null, outputArea,
"Initialisasi Matriks A dan B",
JOptionPane.INFORMATION_MESSAGE );
System.exit(0);
}//end main
public static void genOutput(int array[][])
{
int i;
int j;
for (i=0;i<2;i++)
{
output += "\n";
for (j=0;j<2;j++)
output += array[i][j] + "\t";
}
for (i=0;i<2;i++)
{
output += "\n";
for (j=0;j<2;j++)
output += array[i][j] ;
}
}
}
//end class
/**********/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -