Dante Hunter wrote:How to i find the total numbers of hello printed?
e.g.
System.out.println("Hello");
System.out.println("Hello2")
System.out.println("Hello3")
System.out.println("Hello4")
System.out.println("Total of number of hellos are " + count);
You would have to have a variable cnt (good abbreviation for count) that coincides with each hello printed.
Like -
int cnt = 0; //cnt is 0
System.out.println("Hello");
cnt++; //increase cnt by 1
System.out.println("Hello2")
cnt++; //increase cnt by 1
System.out.println("Hello3")
cnt++; //increase cnt by 1
System.out.println("Hello4")
cnt++; //cnt is 4 after this line
System.out.println(cnt); // prints 4
At the end, cnt could tell you how many hellos were printed. But usually it would be in a loop like the example Alberto gave -- and that is more flexible too. I'm showing you the basic thing that has to happen.