我的代码没有错啊 为什么 会不让我过呢?

来源:2-6 Java中的数据类型

Boy波丶

2017-03-30 09:53

public class HelloWorld{

    public static void main(String[] args) {

String a="爱慕课";

   char  b='男';

   int c=18;

   double d=120.5;

   boolean e=true;

   System.out.println("姓名:"+a+"  性别:"+b);

   System.out.println("中奖数字:"+c+"价格:"+d);

   System.out.println("确定要关闭程序吗:"+e);

}

}


写回答 关注

3回答

  • 七21
    2017-03-30 11:44:51

    2017-3-30 11:47:28 org.apache.catalina.core.AprLifecycleListener init

    信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Users\Administrator\AppData\Local\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\bin;C:\Program Files\Java\apache-tomcat-6.0.33\bin

    2017-3-30 11:47:29 org.apache.coyote.http11.Http11Protocol init

    信息: Initializing Coyote HTTP/1.1 on http-8080

    2017-3-30 11:47:29 org.apache.catalina.startup.Catalina load

    信息: Initialization processed in 442 ms

    2017-3-30 11:47:29 org.apache.catalina.core.StandardService start

    信息: Starting service Catalina

    2017-3-30 11:47:29 org.apache.catalina.core.StandardEngine start

    信息: Starting Servlet Engine: Apache Tomcat/6.0.33

    2017-3-30 11:47:29 org.apache.catalina.startup.HostConfig deployDescriptor

    信息: Deploying configuration descriptor host-manager.xml

    2017-3-30 11:47:29 org.apache.catalina.startup.HostConfig deployDescriptor

    信息: Deploying configuration descriptor manager.xml

    2017-3-30 11:47:29 org.apache.catalina.startup.HostConfig deployDirectory

    信息: Deploying web application directory 03-waike

    2017-3-30 11:47:29 org.apache.catalina.startup.HostConfig deployDirectory

    信息: Deploying web application directory docs

    2017-3-30 11:47:29 org.apache.catalina.startup.HostConfig deployDirectory

    信息: Deploying web application directory examples

    2017-3-30 11:47:30 org.apache.catalina.startup.HostConfig deployDirectory

    信息: Deploying web application directory ROOT

    2017-3-30 11:47:30 org.apache.catalina.startup.HostConfig deployDirectory

    信息: Deploying web application directory thumbnail

    2017-3-30 11:47:30 org.apache.catalina.startup.HostConfig deployDirectory

    信息: Deploying web application directory thumbnail.myeclipse.bak

    2017-3-30 11:47:31 org.apache.coyote.http11.Http11Protocol start

    信息: Starting Coyote HTTP/1.1 on http-8080

    2017-3-30 11:47:31 org.apache.jk.common.ChannelSocket init

    信息: JK: ajp13 listening on /0.0.0.0:8009

    2017-3-30 11:47:31 org.apache.jk.server.JkMain start

    信息: Jk running ID=0 time=0/25  config=null

    2017-3-30 11:47:31 org.apache.catalina.startup.Catalina start

    信息: Server startup in 2847 ms

    2017-3-30 11:47:51 org.apache.catalina.core.StandardWrapperValve invoke

    严重: Servlet.service() for servlet jsp threw exception

    org.apache.jasper.JasperException: /index.jsp(1,2) Page directive has invalid attribute: contextType

    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)

    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)

    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:198)

    at org.apache.jasper.compiler.JspUtil.checkAttributes(JspUtil.java:311)

    at org.apache.jasper.compiler.Validator$DirectiveVisitor.visit(Validator.java:105)

    at org.apache.jasper.compiler.Node$PageDirective.accept(Node.java:608)

    at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)

    at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)

    at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)

    at org.apache.jasper.compiler.Node$Root.accept(Node.java:495)

    at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)

    at org.apache.jasper.compiler.Validator.validateDirectives(Validator.java:1723)

    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:182)

    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)

    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)

    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)

    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)

    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)

    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)

    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)

    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)

    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)

    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)

    at java.lang.Thread.run(Thread.java:619)

    这种错误该怎么办?


    Gir非碼農

    出现原因:tomcat对保存硬盘的session读取失败 解决方法:打开TOMCAT的安装目录,在WORK文件夹找到Catalina\localhost\你的工程名所在文件夹下, 把里面的session.ser删除即可。 但是我进入到我的项目下居然没搜索出这个文件,最后搜索出localhost文件夹下所有的session.ser文件并删除掉才解决了该问题。 你试试吧

    2017-03-30 16:37:49

    共 1 条回复 >

  • ziom
    2017-03-30 10:02:41

    这是慕课网的问题,不用太计较,试试下面这个:

    public class HelloWorld{
        public static void main(String[] args) {
            String name="爱慕课";
            char sex='男';
            int num=18;
            double price=120.5;
            boolean isOK=true;
            System.out.println(name);
            System.out.println(sex);
            System.out.println(num);
            System.out.println(price);
            System.out.println(isOK);
        }
    }

    求采纳!

  • Gir非碼農
    2017-03-30 09:57:14

    代码可以通过~

    姓名:爱慕课  性别:男
    中奖数字:18价格:120.5
    确定要关闭程序吗:true

    你的意思是不能通过慕课网这里是吗?因为慕课网对答案是模式匹配,你应该使用它们给你的变量名称。这样就能通过了

Java入门第一季(IDEA工具)升级版

0基础萌新入门第一课,从Java环境搭建、工具使用、基础语法开始

1165574 学习 · 17587 问题

查看课程

相似问题