运行java程序没有反应,简单的Java程序但没有运行?

Hi everybody,

I am new to java I installed netbeans 6.0.1

I tried running the following simple program but it didnor work???

import java.util.*;

public class Hello

{

public static void main(String [] args)

{

Scanner reader = new Scanner(System.in);

String name;

System.out.print("What is your name? ");

name = reader.readLine();

System.out.println(name + " I look forward to a long and fruitful relationship.");

}

}

I got the following error:

init:

deps-jar:

Compiling 1 source file to C:\Documents and Settings\PAAET User\My Documents\NetBeansProjects\JavaApplication8\build\ classes

C:\Documents and Settings\PAAET User\My Documents\NetBeansProjects\JavaApplication8\src\ja vaapplication8\Main.java:28: class, interface, or enum expected

--------------------------------------------------------------------------------

1 error

BUILD FAILED (total time: 0 seconds)

解决方案Try using this code to read the name

name= scanner.next();

The class you have shown us is not the class that was compiled.

kind regards,

Jos

The class you have shown us is not the class that was compiled.

kind regards,

Jos

Thanks but how can I do it I just press the green triangle.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值