求大神,赐教 结果为什么和答案是相反的
package com.imooc; public class Fing { public static void main(String[] args) { String ma="HelloWorld.java"; String You="laiya@imooc.com"; int in='.'; System.out.println("字符'.'出现在:"+ma.lastIndexOf(in)); String pr="java"; System.out.println(You.length()); if (in!=-1&&in!=1&&pr.equals("java")) { System.out.println("java文件正确"); }else { System.out.println("java文件无效"); } int a1='@'; System.out.println(You.indexOf(a1)); int a2='.'; System.out.println(You.indexOf(a2)); if (a1!=-1&&a2>a1) { System.out.println("邮政格式正确"); }else { System.out.println("邮政格式不正确"); }}}
字符'.'出现在:10
15
java文件正确
5
11
邮政格式不正确