
Java
张朝阳的博客
记录一下自己的学习生活,加油
展开
-
OpenJDK 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to No suc
在搭建Maven私服的时候出现这种情况解决方法:将文件放入纯英文目录下,例如D:\nexus\nexus-3.20.1-01-win64\nexus-3.20.1-01\bin结果:启动完成原创 2022-04-19 10:56:44 · 2000 阅读 · 0 评论 -
Maven的settings配置文件更改方案
一、修改本地仓库二、修改maven默认中央仓库为阿里仓库(默认的中央仓库在maven公司的服务器上)三、修改jdk为当前安装版本,可在dos界面输入java -version来进行查看<?xml version="1.0" encoding="UTF-8"?><!--Licensed to the Apache Software Foundation (ASF) under oneor more contributor licens...原创 2022-03-15 10:33:30 · 3112 阅读 · 0 评论 -
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-help-plugin:3.2.0:effective-pom
仔细一看,原来是该目录下缺少创建pom.xml文件<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"&g..原创 2022-03-07 09:31:39 · 435 阅读 · 0 评论 -
Java的super()方法与this()方法
Java super() this()原创 2020-05-17 12:30:48 · 380 阅读 · 0 评论 -
Java的start()和run()方法的区别与联系
java runnable Thread run() start()原创 2020-05-11 09:14:32 · 353 阅读 · 0 评论 -
(java)编写一个程序,分别使用字节流和字符流拷贝一个文本文件。1) 使用FileInputStream、FileOutputStream和FileReader、FileWriter分别进行拷贝。
import java.io.*;public class Fuzhi { public static void main(String[] args)throws Exception{ FileInputStream in=new FileInputStream("D:/HelloWorld.txt"); FileOutputStream out=new FileOutput...原创 2019-03-20 21:58:50 · 5372 阅读 · 0 评论 -
java(某人在玩游戏的时候输入密码112233后成功进入游戏(输错3次则被强行退出),要求用程序实现密码验证的过程。)
使用System.in包装为字符流读取键盘输入。 BufferedReader对字节流进行包装。调用BufferedReader的readLine( )方法每次读取一行。 在for循环中判断读入的密码是否为“112233”,如果是则打印“恭喜您进入游戏”,并跳出循环,否则继续循环读取键盘输入。 当循环完毕,密码还不正确,则打印“密码错误,结束游戏”,并调用System.exit( 0)方法结...原创 2018-12-28 22:48:36 · 1719 阅读 · 0 评论 -
编写一个程序,分别使用字节流和字符流拷贝一个文本文件。(欢迎大家评论)
使用FileInputStream、FileOutputStream和FileReader、FileWriter分别进行拷贝。 使用字节流拷贝时,定义一个1024长度的字节数组作为缓冲区,使用字符流拷贝,使用BufferedReader和BufferedWriter包装流进行包装。import java.io.*;public class Fuzhi { public static vo...原创 2018-12-28 22:46:28 · 5476 阅读 · 2 评论 -
Exception in thread "main" java.io.FileNotFoundException: D:\HelloWorld.txt遇到这种情况怎么做
第一种:添加绝对路径 比如"D:/HelloWorld.txt" 要么写成/要么写成\\, 第二种:创建的时候不要写成HelloWold,txt要写成HelloWorld,原因暂且不清楚(原因是没有显示文件格式,应该在文件管理器里找到显示文件格式,本来就是txt格式,我又加了个txt...原创 2018-12-28 14:16:17 · 20062 阅读 · 3 评论 -
(java) 使用parseInt( ) 方法编程实现在屏幕上打印“%”矩形,其中的宽和高由运行时传入的参数来决定。(要求高15,宽25)
public class Picture { public static void main(String args[]){ int w=Integer.parseInt(args[0]); int h=Integer.parseInt(args[1]); for(int i=0;i<h;i++){ //StringBuffer sb=new StringBuffer(...原创 2018-12-22 22:26:05 · 1287 阅读 · 1 评论 -
(java)某一工程的开始时间是2017年7月25日,假设工期为180天,编程输出竣工日期。要求使用Calendar类的set( )和add( )方法来实现。
import java.util.*;public class Ca{ public static void main(String[] args){ Calendar calendar=Calendar.getInstance(); calendar.set(2017,7,25); calendar.add(Calendar.DATE,180); int year=cale...原创 2018-12-22 22:22:19 · 1014 阅读 · 0 评论 -
(java) 编写一个程序,实现字符串大小写的转换并倒序输出,要求如下:
public class Test {public static void main(String[] args) {String str = "HelloWorld";// 字符串转成 char 数组char[] ch = str.toCharArray();StringBuffer buffer = new StringBuffer(); for (int i = str.leng...原创 2018-12-22 22:21:15 · 13623 阅读 · 0 评论 -
使用StringBuffer类提供的length( )和capacity( )方法完成三种不同构造方法构造StringBuffer对象的输出。(java)
public class Structer { public static void main(String[] args) throws Exception{ StringBuffer sb = new StringBuffer(20); /*String str1=new String(); System.out.println(str1); System.ou...原创 2018-12-20 21:52:07 · 1103 阅读 · 0 评论 -
java(模拟王老师、李老师和张老师三个老师同时分发80份学习笔记,每个老师相当于一个线程。)
public class Note { public static void main(String[] args){ Paper quantity=new Paper(); new Thread(quantity,"王老师").start(); new Thread(quantity,"李老师").start(); new Thread(quantity,"张老师").sta...原创 2018-11-30 23:07:48 · 6992 阅读 · 2 评论 -
java(通过实现Runnable接口的方式创建一个新线程,要求main线程打印100次“main”,新线程打印50次“new”。)
public class Type { public static void main(String[] args){ MyThread me=new MyThread(); Thread thread=new Thread(me); thread.start(); for(int i=0;i<50;i++){ System.out.println("main");...原创 2018-11-30 21:41:49 · 6606 阅读 · 0 评论 -
Java(通过继承Thread类的方式创建两个线程,在Thread构造方法中指定线程的名字“线程一”、“线程二”,并将这两个线程的名字打印出来。)
public class Double { public static void main(String[] args){ Mythread one=new Mythread(); Mthread two=new Mthread(); one.setName("线程一"); two.setName("线程二"); one.start(); two.start(); }...原创 2018-11-30 20:22:52 · 8270 阅读 · 0 评论 -
编程打印如下图案(每行打印5个星号,每个星号之间的空两个空格)。 * * * * * * * * * * * * * * * (java)
程序如下:public class J5{ public static void main(String [] args){ for(int i=0;i<5;i++){ for(int j=0;j<5;j++){ System.out.print("* "); }System.out.println();for(int a...原创 2018-09-29 16:35:16 · 11345 阅读 · 0 评论 -
编程计算某年某月某日是该年的第多少天。例如:2016年3月2日是2016的 第62 天。(java)
程序如下:mport java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class J6{ public static void main(String[] args) throws Exception { BufferedRe...原创 2018-09-28 21:08:46 · 3908 阅读 · 0 评论