@PhilAnderson/

AddingToAStringDemo

Java

Demonstrating basic concatenation with Strings.

fork
loading
Files
  • Main.java
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Main {
  public static void main(String[] args) {
    System.out.println(test());
    loop(10);

  }
  public static String test(){
    String str = "";
    str += "H";
    str += "i";
    str += "!";
    return str;
  }
  public static void loop(int numLoops){
    for(int count = 0; count < numLoops; count++){
      System.out.print("$");
    }
  }
}