会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132849个问题
JAVA 全系列/(旧的隐藏)第七阶段:JAVA 高级技术/Zookeeper 33243楼

问题:

W~4J`0$8J]I{FT}XR7FIN`7.png

老师,最后一问如何解决呢。

代码:

public class Store {
    private int id;
    private String name;
    private String number;
    private double price;
    private double discount;
    private double sale_price;


    public Store(int id, String name, String number, double price, double discount) {
        this.id = id;
        this.name = name;
        this.number = number;
        this.price = price;
        this.discount = discount;
    }

 public String toString(){
        return "["+id+","+name+","+number+","+price+"discount"+"]";
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public double getDiscount() {
        return discount;
    }

    public void setDiscount(double discount) {
        this.discount = discount;
    }

    public double getSale_price(double m) {
        if (m<(this.price*this.discount)){
            System.out.println(this.name);
        }else {
            System.out.println("这个商品价格太低了");

        }
        return m;
    }

    public void setSale_price(double sale_price) {
        this.sale_price = sale_price;
    }

    public static void main(String[] args) {
        Store[]stores={new Store(1,"baizhan_mouse","BZ_001",99,0.9) ,
                new Store(2,"doll","WO_102",403.00,0.7),
                new Store(3,"java","BK_001",89.00,0.8),
                new Store(4,"suit","GQ_XF_12",700.00,0.5),
                new Store(5,"Mi_phone","DM_PH_13",900.00,0.3)};

        for (int t=0;t<stores.length;t++){
            System.out.println(stores[t]);
        }
        //System.out.println(Arrays.toString(stores));
        }
        }


JAVA 全系列/第一阶段:JAVA 快速入门/数组和数据存储 33244楼

提问:

        老师,我在做这个项目整合的时候在xml配置文件里面把包名写错了。这样会导致启动tomcat的时候看不出问题,但是访问页面的时候是404.死活找不到原因,这种情况一般怎么排查?eclipse的控制台显示的启动信息里面也不会记录这个错误,一直显示正常启动,8080端口也是开放监听,但实际上里面部署的war有问题。



[INFO] Scanning for projects...

[INFO] 

[INFO] --------------------------< com.lx:solrDemo2 >--------------------------

[INFO] Building solrDemo2 0.0.1-SNAPSHOT

[INFO] --------------------------------[ war ]---------------------------------

[INFO] 

[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ solrDemo2 ---

[INFO] Deleting D:\source\solrDemo2\target

[INFO] 

[INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) > process-classes @ solrDemo2 >>>

[INFO] 

[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ solrDemo2 ---

[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!

[INFO] Copying 0 resource

[INFO] Copying 8 resources

[INFO] 

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ solrDemo2 ---

[INFO] Changes detected - recompiling the module!

[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!

[INFO] Compiling 1 source file to D:\source\solrDemo2\target\classes

[INFO] 

[INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) < process-classes @ solrDemo2 <<<

[INFO] 

[INFO] 

[INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ solrDemo2 ---

[INFO] Running war on http://localhost:8080/

[INFO] Creating Tomcat server configuration at D:\source\solrDemo2\target\tomcat

[INFO] create webapp with contextPath: 

四月 17, 2020 12:32:51 下午 org.apache.coyote.AbstractProtocol init

信息: Initializing ProtocolHandler ["http-bio-8080"]

四月 17, 2020 12:32:51 下午 org.apache.catalina.core.StandardService startInternal

信息: Starting service Tomcat

四月 17, 2020 12:32:51 下午 org.apache.catalina.core.StandardEngine startInternal

信息: Starting Servlet Engine: Apache Tomcat/7.0.47

四月 17, 2020 12:32:53 下午 org.apache.catalina.core.ApplicationContext log

信息: No Spring WebApplicationInitializer types detected on classpath

四月 17, 2020 12:32:53 下午 org.apache.catalina.core.ApplicationContext log

信息: Initializing Spring root WebApplicationContext

log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).

log4j:WARN Please initialize the log4j system properly.

log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

四月 17, 2020 12:32:54 下午 org.apache.catalina.core.ApplicationContext log

信息: Initializing Spring FrameworkServlet 'springmvc'

四月 17, 2020 12:32:55 下午 org.apache.coyote.AbstractProtocol start

信息: Starting ProtocolHandler ["http-bio-8080"]


JAVA 全系列/(旧的隐藏)第七阶段:JAVA 高级技术/Solr 33247楼
Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 33250楼
JAVA 全系列/(旧的隐藏)第八阶段:电商高级项目_架构/编码/电商ego-基于SOA架构_Dubbo使用_逆向工程_分页插件完成商品查询 33251楼
JAVA 全系列/第三阶段:数据库编程/Oracle 数据库的使用 33252楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/多线程技术(旧) 33253楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637