-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathveckan5_methodr_o3.java
More file actions
39 lines (34 loc) · 907 Bytes
/
veckan5_methodr_o3.java
File metadata and controls
39 lines (34 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* 3. Förbättra funktionen i förr uppgiften så att den även
har ett argument för enkla eller dubbla linje.
Som default är den inställd på enkla linjer men ges värde
2 till argumentet så erhålls dubbla d.v.s. något i denna stil
=============================
*/
package veckan5;
public class Veckan5 {
static void print(String Symbol,int n){
//n=10;
//Symbol="a";
String result = "";
for (int i = 0; i < n; i += 1) {
result += Symbol;
System.out.print(Symbol);
}
}
static void print2(String Symbol,int n){
//n=10;
//Symbol="a";
String result = "";
for (int i = 0; i < n; i += 1) {
result += Symbol;
System.out.print(Symbol);
}
}
public static void main(String[] args) {
// TODO code application logic here
print("-",20);
System.out.println("");
print2 ("-",20);
}
}