How does paintComponent work?

The (very) short answer to your question is that paintComponent is called “when it needs to be.” Sometimes it’s easier to think of the Java Swing GUI system as a “black-box,” where much of the internals are handled without too much visibility. There are a number of factors that determine when a component needs to … Read more

What is the purpose of Java DOT operator?

Can somebody tell me what Java DOT operator actually does? For example: public class { int value; public void great() {}; … } public static void main(String[] args) { Person p = new Person(); Person.great(); // <— here Person.value; // <— here I want to know what is . operator doing in above code when … Read more

atoi in java using charAt

char digit = (char)(tmp.charAt(i) – ‘0’); In the ascii table, characters from ‘0’ to ‘9’ are contiguous. So, if you know that tmp.charAt(i) will return a character between 0 and 9, then subracting 0 will return the offset from zero, that is, the digit that that character represents.

return an ArrayList method

This is a drive method for two other classes. which i posted here https://codereview.stackexchange.com/questions/33148/book-program-with-arraylist I need some help for the private static ArrayList getAuthors(String authors) method. I am kind a beginner. so please help me finish this drive method. or give me some directions. Instruction some of the elements of the allAuthors array contain asterisks … Read more