Bonjour,
Je suis dsl de faire deux postes mais je ne comprend pas comment retourner une valeur enfin tout particulierement un certain type de valeur. je dois pensser java et j'essai de faire ca comme en C, donc il y a de fortes chances que cela ne marche pas![]()
si non je ne serais pas la a vous posez des questions qui doivent sembler toutes bete dsl![]()
Voila donc mon problem, j'ai cree une fonction qui devrais me retourber un char*, enfin String , mais le problem ce pose a la compilation, voila le .java qui me pose problems
et voila les erreurs de compilations, j'aimerais bien connaitres les raisons
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 import java.awt.*; import java.io.*; import java.io.FileNotFoundException; public class my_reading { public static String my_reading() { String fd = "FileConfig"; String buffer; int i = 0; int size; int begin; String back; try { FileReader fr = new FileReader (fd); BufferedReader buff = new BufferedReader (fr); buffer = buff.readLine (); buff.close(); } catch (FileNotFoundException e) { System.out.println ("ERREUR: FileConfig not found"); } catch (IOException e) { System.out.println ("ERREUR: C'ant open FileConfig"); } return (buffer); } }![]()
j'ai fais des recherche sur google j'ai trouver des reponses qui ramenebt touts a la classe SubString ou autre, mais je n'ai pas tout saisie, pas fautes d'avoir chercher![]()
voila les erreurs
Je ne comprend pas du tout :/
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 % javac *.java Found 1 semantic error and issued 1 warning compiling "my_reading.java": 6. public static String my_reading() ^---------------^ *** Semantic Warning: The name of this method "my_reading" matches the name of the containing class. However, the method is not a constructor since its declarator is qualified with a type. 34. return (buffer); ^----^ *** Semantic Error: The variable "buffer" may be accessed here before having been definitely assigned a value.
Je vous remerci par avance
Partager