Ivo Pereira Posted May 27, 2008 at 04:47 PM Report Share #187863 Posted May 27, 2008 at 04:47 PM Boas pessoal, ao ler uns tutoriaizitos vi uma função que é o Scanner, que permite ler o que o user escrever. Este é o meu código feito no NetBeans IDE 6.1: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package javaapplication1; import java.util.Scanner; /** * * @author Ivo */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner s = New Scanner(System.in); System.out.print("|''''''''''''''''''''''''''''''''''''''''''''|\n"); System.out.print("|-----------Powered by: Ivo Pereira----------|\n"); System.out.print("|''''''''''''''''''''''''''''''''''''''''''''|\n"); System.out.print("| |\n"); System.out.print("| My first Java app |\n"); System.out.print("| Made in Netbeans IDE |\n"); System.out.print("|____________________________________________|\n"); String linha = s.NextLine(); System.out.print(linha); } } O que é que está mal aqui? Dá-me este erro: init:deps-jar: Compiling 1 source file to C:\Users\Ivo\Documents\NetBeansProjects\JavaApplication1\build\classes C:\Users\Ivo\Documents\NetBeansProjects\JavaApplication1\src\javaapplication1\Main.java:19: ';' expected Scanner s = New Scanner(System.in); 1 error BUILD FAILED (total time: 1 second) Cumps Ok.. que ESTUPIDEZ DA MINHA PARTE! O Java é case-sensitive nos objectos, métodos, tudo! É por isso que isto não reconhecia. Aqui está o código correcto: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package javaapplication1; import java.util.Scanner; /** * * @author Ivo */ public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.print("|''''''''''''''''''''''''''''''''''''''''''''|\n"); System.out.print("|-----------Powered by: Ivo Pereira----------|\n"); System.out.print("|''''''''''''''''''''''''''''''''''''''''''''|\n"); System.out.print("| |\n"); System.out.print("| My first Java app |\n"); System.out.print("| Made in Netbeans IDE |\n"); System.out.print("|____________________________________________|\n"); String linha = s.nextLine(); System.out.print(linha); } } Cumps and ty Link to comment Share on other sites More sharing options...
Knitter Posted May 27, 2008 at 05:34 PM Report Share #187872 Posted May 27, 2008 at 05:34 PM Java é case sensitive, ponto final 🙂 www.sergiolopes.eu Link to comment Share on other sites More sharing options...
Ivo Pereira Posted May 27, 2008 at 05:42 PM Author Report Share #187875 Posted May 27, 2008 at 05:42 PM Java é case sensitive, ponto final 🙂 E eu que andei p'aqui às voltas por isto 😄 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now