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

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/cache"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/context
                           http://www.springframework.org/schema/context/spring-context.xsd
                           http://www.springframework.org/schema/mvc
                           http://www.springframework.org/schema/mvc/spring-mvc.xsd
                           http://www.springframework.org/schema/cache
                           http://www.springframework.org/schema/cache/spring-cache.xsd">

    <!--配置注解扫描-->
    <context:component-scan base-package="controller,interceptor"/>

    <!--配置注解驱动-->
    <mvc:annotation-driven/>

    <!--配置视图解析器-->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/jsp/"/>
        <property name="suffix" value=".jsp"/>
    </bean>

    <!--配置拦截器-->
    <mvc:interceptors>
        <!--配置全局拦截器-->
        <bean class="interceptor.MyInterceptor"/>
        <mvc:interceptor>
            <!--mapping: 配置拦截器的作用路径-->
            <mvc:mapping path="/**"/>
        </mvc:interceptor>
    </mvc:interceptors>
</beans>

引入了mvc标签但是使用不了什么原因,说检测不到

JAVA 全系列/第六阶段:项目管理与SSM框架/SpringMVC 20973楼

package com.itbaizhan;

import com.sun.imageio.plugins.wbmp.WBMPImageReader;

import java.util.Stack;

public class StackTest {
    public static void main(String[] args) {

        //实例化
        Stack<String> stack = new Stack<>();

        System.out.println(stack.empty());



        //将元素添加到栈容器中
        stack.push("a");
        stack.push("f");
        stack.push("b");
        //返回元素位置
        System.out.println(stack.search("a"));
        //查找栈元素
        System.out.println(stack.peek());
        //获取
        String pop = stack.pop();
        System.out.println(pop);
        String pop1 = stack.pop();
        System.out.println(pop1);
        String pop2 = stack.pop();
        System.out.println(pop2);

        System.out.println("----------------------------");

        StackTest stackTest = new StackTest();
        stackTest.symmetry();




    }

    public void symmetry(){
        String str = "..(......{....{[[.......}]]]]..]]........";
        Stack<String> stack = new Stack<>();

        boolean flag = true;

        for(int i = 0;i<str.length();i++){
            char c = str.charAt(i);
            if (c=='{'){
                stack.push("}");

            }
            if (c == '['){
                stack.push("]");
            }
            if (c == '('){
                stack.push(")");
            }

            //判断是否匹配
            if (c=='}'||c ==']'||c==')'){
                if (stack.empty()){
                    flag = false;
                    break;
                }
            }
            String x = stack.pop();
            if (x.charAt(0)!=c){
                 flag = false;
                 break;
            }
        }
        if (!stack.empty()){
            flag = false;

        }
        System.out.println(flag);
    }


}




true

3

b

b

f

a

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

Exception in thread "main" java.util.EmptyStackException

at java.util.Stack.peek(Stack.java:102)

at java.util.Stack.pop(Stack.java:84)

at com.itbaizhan.StackTest.symmetry(StackTest.java:69)

at com.itbaizhan.StackTest.main(StackTest.java:36)

这是怎么了

JAVA 全系列/第二阶段:JAVA 基础深化和提高/容器(旧) 20975楼
JAVA 全系列/第三阶段:数据库编程/SQL 语言 20976楼
JAVA 全系列/第十阶段:百战旅游网项目/百战旅游网 20978楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/网络编程(旧) 20981楼
Python 全系列/第四阶段:函数式编程和核心特性/装饰器深入剖析 20982楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/多线程技术(旧) 20983楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/表单 20984楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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