← Back to feed
Renewal·서른의 생활코딩

ex14) java

NS
normalstory
cover image





class Test06{
        void Star(int st){     
                // the number of [types + parameters] must match!!! -> `int` declaration
                // `st` = parameter = user-defined name
                // when execution reaches the code `int st`, memory is allocated
                // and when the Star function scope ends, that memory disappears
                // local variable `st = 50` (not assignment in concept, but initialization!!!)
        int i;
        for(i=0;i<=st;i++){
                System.out.print("*");
                //if(i==10) return;
                }
        System.out.print("\n");
        // return;
        }
}

public class fun06 {
        public static void main(String[] args) {
        Test06 t = new Test06();
        t.Star(50);  // type + parameter count must match!!! (see above)
        System.out.println("Hello Java");
        t.Star(40);  
        int a=1;
        t.Star(a);  
        }

}

This English version was translated by Codex.

친절한 찰쓰씨
Written by
친절한 찰쓰씨

Pleasant Charles — UI/UX researcher at AIT. Keeping notes on design, planning, and slow days here since 2010.