基本环境的创建

pom依赖

 <?xml version="1.0" encoding="UTF-8"?>
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.player3.es</groupId>
    <artifactId>estest</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>estest</name>
    <description>Demo project for Spring Boot</description>
 ​
    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <spring-boot.version>2.3.7.RELEASE</spring-boot.version>
    </properties>
 ​
    <dependencies>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>7.8.0</version>
        </dependency>
        <!-- elasticsearch的客户端 -->
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>7.8.0</version>
        </dependency>
        <!-- elasticsearch依赖2.x的log4j -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.8.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.8.2</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.9.9</version>
        </dependency>
        <!-- junit单元测试 -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
 ​
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
 ​
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>
 ​
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
 ​
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.3.7.RELEASE</version>
                <configuration>
                    <mainClass>com.player3.es.estest.EstestApplication</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <id>repackage</id>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
 ​
 </project>
 ​

创建索引 EsTest_Client

 public static void main(String[] args) throws IOException {
       //创建es客户端对象
         RestHighLevelClient esclient = new RestHighLevelClient(
                 RestClient.builder(new HttpHost("localhost",9200,"http"))
        );
         ///关闭连接
         esclient.close();
    }

通过:localhost:9200/_cat/indices?v 查看,确实新增一条索引

查询索引 EsTest_index_search

  public static void main(String[] args) throws IOException {
      //创建es客户端对象
        RestHighLevelClient esclient = new RestHighLevelClient(
                RestClient.builder(new HttpHost("localhost",9200,"http"))
        );
 ​
        GetIndexRequest player3 = new GetIndexRequest("player3");
        GetIndexResponse response = esclient.indices().get(player3, RequestOptions.DEFAULT);
 ​
          System.out.println(response.getAliases());
          System.out.println(response.getDataStreams());
          System.out.println(response.getDefaultSettings());
          System.out.println(response.getIndices());
          System.out.println(response.getMappings());
          System.out.println(response.getSettings());
        ///关闭连接
        esclient.close();
    }

删除索引: EsTest_index_delete

   public static void main(String[] args) throws IOException {
      //创建es客户端对象
        RestHighLevelClient esclient = new RestHighLevelClient(
                RestClient.builder(new HttpHost("localhost",9200,"http"))
        );
        DeleteIndexRequest shoppingg = new DeleteIndexRequest("shoppingg");
 ​
        AcknowledgedResponse delete = esclient.indices().delete(shoppingg, RequestOptions.DEFAULT);//create(request, RequestOptions.DEFAULT);
 ///关闭连接
        System.out.println(delete.isAcknowledged());
        esclient.close();
    }

在索引下新增数据 EsTest_Client_Doc_Insert

 class User
 ​
 private String name;
  private String sex;
  private Integer age;
  public static void main(String[] args) throws IOException {
      //创建es客户端对象
        RestHighLevelClient esclient = new RestHighLevelClient(
                RestClient.builder(new HttpHost("localhost",9200,"http"))
        );
        //插入数据
        IndexRequest indexRequest = new IndexRequest();
        //需要插入的数据 index|索引 id|唯一标识
        indexRequest.index("user").id("1020");
        User user = new User();
        user.setName("李为");
        user.setSex("男");
        user.setAge(27);
        // 向es插入数据,必须将数据转换为json jackson
        ObjectMapper mapper=new ObjectMapper();
        String userjson = mapper.writeValueAsString(user);//对象转str
        indexRequest.source(userjson, XContentType.JSON);//index为user,id1020的数据
        IndexResponse index = esclient.index(indexRequest, RequestOptions.DEFAULT);
        System.out.println(index);
        ///关闭连接
        esclient.close();
    }

索引下的修改数据 EsTest_Client_Doc_Update

 ​
    //TODO 如果直接把全部的值替换 就是全量更新
 //   public static void main(String[] args) throws IOException {
 //       //创建es客户端对象
 //       RestHighLevelClient esclient = new RestHighLevelClient(
 //               RestClient.builder(new HttpHost("localhost",9200,"http"))
 //       );
 //       //插入数据
 //       IndexRequest indexRequest = new IndexRequest();
 //       //需要插入的数据 index|索引 id|唯一标识
 //       indexRequest.index("user").id("1020");
 //
 //       User user = new User();
 //       user.setName("李为");
 //       user.setSex("男");
 //       user.setAge(26);
 //       // 向es插入数据,必须将数据转换为json jackson
 //       ObjectMapper mapper=new ObjectMapper();
 //       String userjson = mapper.writeValueAsString(user);//对象转str
 //       indexRequest.source(userjson, XContentType.JSON);//index为user,id1020的数据
 //       IndexResponse index = esclient.index(indexRequest, RequestOptions.DEFAULT);
 //       System.out.println(index);
 //       ///关闭连接
 //       esclient.close();
 //   }
 ​
    public static void main(String[] args) throws IOException {
                //创建es客户端对象
        RestHighLevelClient esclient = new RestHighLevelClient(
                RestClient.builder(new HttpHost("localhost",9200,"http"))
        );
 ​
 ​
        UpdateRequest update = new UpdateRequest();
        update.index("user").id("1020");
      update.doc(XContentType.JSON,"sex","女","age",18);
 ​
        esclient.update(update, RequestOptions.DEFAULT);
        esclient.close();
    }

索引下的删除数据 EsTest_Client_Doc_delete

   public static void main(String[] args) throws IOException {
      //创建es客户端对象
        RestHighLevelClient esclient = new RestHighLevelClient(
                RestClient.builder(new HttpHost("localhost",9200,"http"))
        );
        DeleteRequest deleteRequest = new DeleteRequest();
        deleteRequest.index("user").id("1020");
        esclient.delete(deleteRequest, RequestOptions.DEFAULT);
 ​
 ​
        ///关闭连接
        esclient.close();
    }

索引下的批量插入 EsTest_Client_Doc_insert_bash

 public static void main(String[] args) throws IOException {
//创建es客户端对象
RestHighLevelClient esclient = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost",9200,"http"))
);
BulkRequest request = new BulkRequest();
request.add(new IndexRequest().index("user").id("1010").source(XContentType.JSON,
"name","李伟","age",27,"sex","男"));
request.add(new IndexRequest().index("user").id("1011").source(XContentType.JSON,
"name","lisi","age",22,"sex","女"));
request.add(new IndexRequest().index("user").id("1012").source(XContentType.JSON,
"name","wangwu","age",26,"sex","女"));
request.add(new IndexRequest().index("user").id("1013").source(XContentType.JSON,
"name","zhaoliu","age",27,"sex","女"));
esclient.bulk(request, RequestOptions.DEFAULT);
///关闭连接
esclient.close();
}

索引下的批量删除数据 EsTest_Client_Doc_delete_bash

 public static void main(String[] args) throws IOException {
//创建es客户端对象
RestHighLevelClient esclient = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost",9200,"http"))
);
BulkRequest request = new BulkRequest();
request.add(new DeleteRequest().index("user").id("1010"));
request.add(new DeleteRequest().index("user").id("1011"));
request.add(new DeleteRequest().index("user").id("1012"));
request.add(new DeleteRequest().index("user").id("1013"));
esclient.bulk(request, RequestOptions.DEFAULT);
///关闭连接
esclient.close();
}

条件查询之全部查询 EsTest_Client_Query

public static void main(String[] args) throws IOException {
//创建es客户端对象
RestHighLevelClient esclient = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost",9200,"http"))
);
SearchRequest searchRequest = new SearchRequest();
searchRequest.indices("user");
//查询所有的数据
searchRequest.source(new SearchSourceBuilder().query(QueryBuilders.matchAllQuery()));
SearchResponse search = esclient.search(searchRequest, RequestOptions.DEFAULT);
// System.out.println(search);
SearchHits hits = search.getHits();
System.out.println(hits.getTotalHits());
System.out.println(search.getTook());
for(SearchHit hit:hits){
System.out.println(hit.getSourceAsString());
}
///关闭连接
esclient.close();
}

条件查询之匹配查询 EsTest_Client_termQuery

 public static void main(String[] args) throws IOException {
//创建es客户端对象
RestHighLevelClient esclient = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost",9200,"http"))
);
SearchRequest req = new SearchRequest();
req.indices("user");
req.source(new SearchSourceBuilder().query(QueryBuilders.termQuery("age",27))); SearchResponse search = esclient.search(req, RequestOptions.DEFAULT); ///关闭连接
esclient.close();
SearchHits hits = search.getHits();
for(SearchHit hit:hits){
System.out.println(hit.getSourceAsString());
}
}

条件查询之分页查询 EsTest_Client_From_Size

 public static void main(String[] args) throws IOException {
//创建es客户端对象
RestHighLevelClient esclient = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost",9200,"http"))
);
SearchRequest searchRequest = new SearchRequest();
SearchSourceBuilder query = new SearchSourceBuilder().query(QueryBuilders.matchAllQuery());
query.from(0);//当前页
query.size(3);//每页条数
searchRequest.indices("user");
searchRequest.source(query);
// searchRequest.
SearchResponse search = esclient.search(searchRequest, RequestOptions.DEFAULT);
SearchHits hits = search.getHits();
for(SearchHit hit:hits){
System.out.println(hit.getSourceAsString());
}
///关闭连接
esclient.close();
}

条件查询之排序 EsTest_Client_From_Size_Sort

  public static void main(String[] args) throws IOException {
//创建es客户端对象
RestHighLevelClient esclient = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost",9200,"http"))
);
SearchRequest searchRequest = new SearchRequest();
SearchSourceBuilder query = new SearchSourceBuilder().query(QueryBuilders.matchAllQuery());
query.from(0);//当前页
query.size(3);//每页条数
query.sort("age", SortOrder.DESC);
searchRequest.indices("user");
searchRequest.source(query);
// searchRequest.
SearchResponse search = esclient.search(searchRequest, RequestOptions.DEFAULT);
SearchHits hits = search.getHits();
for(SearchHit hit:hits){
System.out.println(hit.getSourceAsString());
}
///关闭连接
esclient.close();
}

条件查询之排除某列 EsTest_Client_Fetch

public static void main(String[] args) throws IOException {
//创建es客户端对象
RestHighLevelClient esclient = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost",9200,"http"))
);
SearchRequest searchRequest = new SearchRequest();
SearchSourceBuilder query = new SearchSourceBuilder().query(QueryBuilders.matchAllQuery());
String[] includes={};//包含
String[] excludes={"age"};//排除 query.fetchSource(includes,excludes);
searchRequest.indices("user");
searchRequest.source(query);
// searchRequest.
SearchResponse search = esclient.search(searchRequest, RequestOptions.DEFAULT);
SearchHits hits = search.getHits();
for(SearchHit hit:hits){
System.out.println(hit.getSourceAsString());
}
///关闭连接
esclient.close();
}

组合查询 EsTest_Client_Should

查询男人 年龄30的

 public static void main(String[] args) throws IOException {
//创建es客户端对象
RestHighLevelClient esclient = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost",9200,"http"))
);
SearchRequest searchRequest = new SearchRequest();
searchRequest.indices("user");
SearchSourceBuilder builder = new SearchSourceBuilder();
BoolQueryBuilder bool = new BoolQueryBuilder();
bool.must(QueryBuilders.matchQuery("sex","男"));
bool.must(QueryBuilders.matchQuery("age",27));
//组合查询
builder.query(bool);
searchRequest.source(builder); SearchResponse search = esclient.search(searchRequest, RequestOptions.DEFAULT);
///关闭连接
SearchHits hits = search.getHits();
esclient.close();
for(SearchHit hit:hits){
System.out.println(hit.getSourceAsString());
} }

查询不是男人的

public static void main(String[] args) throws IOException {
//创建es客户端对象
RestHighLevelClient esclient = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost",9200,"http"))
);
SearchRequest searchRequest = new SearchRequest();
searchRequest.indices("user");
SearchSourceBuilder builder = new SearchSourceBuilder();
BoolQueryBuilder bool = new BoolQueryBuilder();
bool.must(QueryBuilders.matchQuery("age",27));
bool.mustNot(QueryBuilders.matchQuery("sex","男"));
//组合查询
builder.query(bool);
searchRequest.source(builder); SearchResponse search = esclient.search(searchRequest, RequestOptions.DEFAULT);
///关闭连接
SearchHits hits = search.getHits();
esclient.close();
for(SearchHit hit:hits){
System.out.println(hit.getSourceAsString());
} }

年龄为26或27

public static void main(String[] args) throws IOException {
//创建es客户端对象
RestHighLevelClient esclient = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost",9200,"http"))
);
SearchRequest searchRequest = new SearchRequest();
searchRequest.indices("user");
SearchSourceBuilder builder = new SearchSourceBuilder();
BoolQueryBuilder bool = new BoolQueryBuilder();
// age=27 and sex =男
// bool.must(QueryBuilders.matchQuery("age",27));
// bool.mustNot(QueryBuilders.matchQuery("sex","男")); //age=26 or age=27
bool.should(QueryBuilders.matchQuery("age",27));
bool.should(QueryBuilders.matchQuery("age",26)); //组合查询
builder.query(bool);
searchRequest.source(builder); SearchResponse search = esclient.search(searchRequest, RequestOptions.DEFAULT);
///关闭连接
SearchHits hits = search.getHits();
esclient.close();
for(SearchHit hit:hits){
System.out.println(hit.getSourceAsString());
} }

年龄大于等于27小于40

 public static void main(String[] args) throws IOException {
//创建es客户端对象
RestHighLevelClient esclient = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost",9200,"http"))
);
SearchRequest searchRequest = new SearchRequest();
searchRequest.indices("user");
SearchSourceBuilder builder = new SearchSourceBuilder();
//年龄大于等于27小于40
RangeQueryBuilder age = QueryBuilders.rangeQuery("age");
age.gte(27);
age.lt(40);
//组合查询
builder.query(age);
searchRequest.source(builder); SearchResponse search = esclient.search(searchRequest, RequestOptions.DEFAULT);
///关闭连接
SearchHits hits = search.getHits();
esclient.close();
for(SearchHit hit:hits){
System.out.println(hit.getSourceAsString());
} }

高亮查询 EsTest_Client_GaoLiang

 public static void main(String[] args) throws IOException {
//创建es客户端对象
RestHighLevelClient esclient = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost",9200,"http"))
);
SearchRequest request = new SearchRequest();
request.indices("user");
SearchSourceBuilder builder = new SearchSourceBuilder();
TermQueryBuilder termQueryBuilder = QueryBuilders.termQuery("name", "zhaoliu"); //SearchSourceBuilder 带有高亮标签
//记住这里是创建的不是 builder.highlighter 空参弄出来的,不然会报错的
HighlightBuilder highlighter = new HighlightBuilder();
highlighter.preTags("<font color='red'>");//前缀
highlighter.postTags("</font>");//后缀
highlighter.field("name");//name属性高亮显示
builder.highlighter(highlighter);
builder.query(termQueryBuilder); request.source(builder);
SearchResponse search = esclient.search(request, RequestOptions.DEFAULT); SearchHits hits = search.getHits();
///关闭连接
esclient.close();
for(SearchHit hit:hits){
System.out.println(hit.getSourceAsString());
} }

聚合查询

求最大值

    public static void main(String[] args) throws IOException {
//创建es客户端对象
RestHighLevelClient esclient = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost",9200,"http"))
);
SearchRequest request = new SearchRequest();
request.indices("user");
SearchSourceBuilder builder = new SearchSourceBuilder();
MaxAggregationBuilder field = AggregationBuilders.max("maxAge").field("age");
builder.aggregation(field);
request.source(builder);
SearchResponse search = esclient.search(request, RequestOptions.DEFAULT); SearchHits hits = search.getHits();
///关闭连接
esclient.close();
for(SearchHit hit:hits){
System.out.println(hit.getSourceAsString());
} }

分组

 public static void main(String[] args) throws IOException {
//创建es客户端对象
RestHighLevelClient esclient = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost",9200,"http"))
);
SearchRequest request = new SearchRequest();
request.indices("user");
SearchSourceBuilder builder = new SearchSourceBuilder();
TermsAggregationBuilder ageGroup = AggregationBuilders.terms("ageGroup").field("age");
builder.aggregation(ageGroup);
request.source(builder);
SearchResponse search = esclient.search(request, RequestOptions.DEFAULT); SearchHits hits = search.getHits();
///关闭连接
esclient.close();
for(SearchHit hit:hits){
System.out.println(hit.getSourceAsString());
} }

es使用java的api操作的更多相关文章

  1. ES的java端API操作

    首先简单介绍下写这篇博文的背景,最近负责的一个聚合型的新项目要大量使用ES的检索功能,之前对es的了解还只是纯理论最多加个基于postman的索引创建操作,所以这次我得了解在java端如何编码实现:网 ...

  2. ES系列十五、ES常用Java Client API

    一.简介 1.先看ES的架构图 二.ES支持的客户端连接方式 1.REST API http请求,例如,浏览器请求get方法:利用Postman等工具发起REST请求:java 发起httpClien ...

  3. Java原生API操作XML

    使用Java操作XML的开源框架比较多,如著名的Dom4J.JDOM等,但个人认为不管你用那个框架都要对JDK原生的API有所了解才能更得心应手的应用.本篇就来简单了解下原生的XML API. JAV ...

  4. 读《分布式一致性原理》JAVA客户端API操作3

    更新数据 客户端可以通过zookeeper的API来更新一个节点的数据内容,有如下两个接口: public Stat setData(final String path, byte data[], i ...

  5. 读《分布式一致性原理》JAVA客户端API操作2

    创建节点 通过客户端API来创建一个数据节点,有一下两个接口: public String create(final String path, byte data[], List<ACL> ...

  6. 读《分布式一致性原理》JAVA客户端API操作

    创建会话 客户端可以通过创建一个Zookeeper实例来连接服务器.4种构造方法如下 ZooKeeper(connectString, sessionTimeout, watcher): ZooKee ...

  7. MongoDB -- JAVA基本API操作

    package com.example.mongodb.mongodb.demo; import com.mongodb.MongoClient; import com.mongodb.client. ...

  8. 1.java soap api操作和发送soap消息

    转自:https://blog.csdn.net/lbinzhang/article/details/84721359 1. /** * soap请求 * * @return * @throws Ex ...

  9. es之java各种查询操作

    matchAllQuery 匹配所有文档 queryStringQuery 基于Lucene的字段检索 wildcardQuery 通配符查询匹配多个字符,?匹配1个字符* termQuery 词条查 ...

随机推荐

  1. 题解 CF833D Red-Black Cobweb

    题目传送门 题目大意 给出一个 \(n\) 个点的树,每条边有边权和颜色 \(0,1\) ,定义一条链合法当且仅当 \(0,1\) 颜色的边数之比小于等于 \(2\) ,求所有合法的链的边权之积的积. ...

  2. Java(14)面向对象之封装

    作者:季沐测试笔记 原文地址:https://www.cnblogs.com/testero/p/15201610.html 博客主页:https://www.cnblogs.com/testero ...

  3. 安装pytorch后import torch显示no module named 'torch'

    问题描述:在pycharm终端里通过pip指令安装pytorch,显示成功安装但是python程序和终端都无法使用pytorch,显示no module named 'torch'. 起因:电脑里有多 ...

  4. 第四次Alpha Scrum Meeting

    本次会议为Alpha阶段第四次Scrum Meeting会议 会议概要 会议时间:2021年4月28日 会议地点:线上会议 会议时长:18min 会议内容简介:本次会议主要由每个人展示自己目前完成的工 ...

  5. 渗透测试神器——Burp的使用

    公众号:白帽子左一 版本说明:Burp Suite2.1 下载地址: 链接:https://pan.baidu.com/s/1JPV8rRjzxCL-4ubj2HVsug 提取码:zkaq 使用环境: ...

  6. 2021.5.24考试总结 [NOIP模拟3]

    带着爆0的心态考的试,没想到整了个假rk2 (炸鱼大佬wtz忒强了OTZ T1 景区路线规划 这题对刚学完概率期望的我来说简直水爆了好吗.. 因为存在时间限制,不好跑高斯消元,就直接跑dp就完了. 令 ...

  7. CSP2021 翻车记

    DAY - INF 日常模拟赛被吊打,不知道为啥总是出一些小问题导致正解gg,成绩的话也就是中游吧,不过方差不小 DAY - 2 感冒了,头疼得很,签到题甚至也签到失败了,烦得很 DAY -1 全真体 ...

  8. 验证人员应该以何种角度阅读spec

    转载:验证人员应该以何种角度阅读spec - 微波EDA网 (mweda.com) 在开发流程中,设计和验证人员关注的点肯定是不一样的,尤其在spec的理解上,验证人员往往需要有自己独立的理解.在拿到 ...

  9. C/C++如何传递二维数组?

    用二维数组作为参数传递(用二维数组处理矩阵),但是希望接受传递二维数组参数的函数可以处理任意维度的数组(希望矩阵的行数和列数都是不固定的). ----------------------------- ...

  10. JAVA笔记1__基本数据类型/输入输出/随机数/数组

    /**八种基本数据类型 boolean byte short int long char float double */ public class test1{ public static void ...