Salut


Quand je veux compiler ce code la ligne int strength = random.nextInt(11); est surlignee et une erreure me dit unreachable statement

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
import java.util.Random;
public class Test
{
  String monstername;
  String advname;
  double sacks;
  Random random = new Random();
  double health;
  double strength;  
 
 
public double Monster(String monstername)
{
 
  double sacks = 10;
  return sacks;
  int health = random.nextInt(101);
  int strength = random.nextInt(11);
  this.monstername = "TheMonster";
  }
 
public double Adventurer(String advname)
{
  Adventurer aAdventurer;
  double sacks = 0;
  int strength = random.nextInt(11);
  int health = random.nextInt(101);
  this.advname = "Adventurer";
  return sacks;
  }
 
public String toString() {
return monstername + ", " + advname;
  }