Hello everybody,

I found some old practice material with questions. Almost all of the answers were in the document but nit all. I just want to make this documentation complete for myself and any other people who want to learn more about java.

The code below is provided by the practice material and the following questions were not anywhere to be found in the documents. I have searched the internet to find resources and learn so I can answer the questions posted below the code.
I hope you guys can help me to determine if the answers I have found through adapting the knowledge I found on the internet is right.

package Practice;
import javax.swing.JOptionPane;
 
public class Oefening1{
 
	public static void main(String[] args) {
		char[] dader = {'A','A','C','A','G','G','C','T'};
 
		char[] controle = new char[dader.length];
 
		for(int x = 0;x < controle.length;x++){
			controle[x] = leesletter();
		}
 
		int percentage = vergelijkDNA(dader,controle);
		JOptionPane.showMessageDialog(null, "Overeenkomst " + percentage + " %",
				"Uitvoer",JOptionPane.INFORMATION_MESSAGE);
		System.exit(0);
	}
 
	public static char leesletter(){
		char houder;
		String temp = JOptionPane.showInputDialog(null,"Voer de letter A G C T in","CSI I",
				JOptionPane.INFORMATION_MESSAGE);
		houder = temp.charAt(0); //De eerste letter van de String wordt ingegeven.
 
		if(houder == 'A'){
			return houder;
		}
		else if(houder == 'G'){
			return houder;
		}
		else if(houder == 'C'){
			return houder;
		}
		else if(houder == 'T'){
			return houder;
		}
		else {
			return 'F';
		}
	}
 
	public static int vergelijkDNA(char[] a,char[] b){
		double dperc = 0;
		double tel = 0;
		int aantal = a.length;
 
		for(int x = 0;x < a.length; x++){
			if(a[x] == b[x]){
				tel++;
			}
		}
 
		dperc = tel/aantal;
		System.out.println(tel + " " + aantal);
		System.out.println(dperc);
		double tperc = dperc * 100;
		int perc = (int)tperc;
		return perc;
	}
}

Question 1: How many methods does this code contain?
My answer:
A. 8
public static void main
JOptionPane.showMessageDialog
System.exit
public static char leesletter (this method is called once in the main method)
JOptionPane.showInputDialog
public static int vergelijkDNA (this method is called once in the main method)
System.out.println(tel + " " + aantal);
System.out.println(dperc);

Question 2: How many arrays are created in the main method?
My answer: 2

I hope to get some more insight in this matter.

Thanks in advance!!!