what should I do to compile this ? it sayis you need one main class .

0 votes
asked Jun 25 by Qrm Qrm (120 points)
private void substitute2DArray(){
    int row , col , k ;
    char tmp ;
    char[] strSAM = {'I','B','M','I','B','M'};
        k =1;
            tmp = str2D[row++][col];
            } else{

1 Answer

+1 vote
answered Jun 26 by Peter Minarik (12,220 points)
edited Jun 26 by Peter Minarik

Your code's structure should look something like this:

public class Main
    private void substitute2DArray()
        // Implement your code here

    public static void main(String[] args)

That being said, your code still would not compile, but at least, you will see compilation errors that make sense now (such as str2D is an undefined variable).

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.