我有一个字符串,"."当我尝试拆分它时,dot它被分开,它没有被吐出.
这是我的确切代码.请让我知道是什么原因可能导致不拆分字符串.
public class TestStringSplit {
public static void main(String[] args) {
String testStr = "[Lcom.hexgen.ro.request.CreateRequisitionRO;";
String test[] = testStr.split(".");
for (String string : test) {
System.out.println("test : " + string);
}
System.out.println("Str Length : " + test.length);
}
}
Run Code Online (Sandbox Code Playgroud)
我必须将上面的字符串分开并仅获取最后一部分.在上面的情况下,请CreateRequisitionRO不要CreateRequisitionRO;帮助我得到这个.
如何列出上次推送到远程 Git 存储库时推送的所有文件?
我有一个项目,只修改了几个文件并将add, commit and push其发送到远程。现在我如何查看已推送到远程的文件列表?
它应该与上次提交 ID 有关吗?
以下是我的 pojo :
package anto.com.poc;
public class VerifyPaymentRO {
private String mihpayid;
private String request_id;
private String bank_ref_num;
private String amt;
private String disc;
private String mode;
private String PG_TYPE;
private String card_no;
private String name_on_card;
private String udf2;
private String addedon;
private String status;
private String unmappedstatus;
private String Merchant_UTR;
private String Settled_At;
public String getMihpayid() {
return mihpayid;
}
public void setMihpayid(String mihpayid) {
this.mihpayid = mihpayid;
}
public String getRequest_id() {
return request_id;
}
public void setRequest_id(String …Run Code Online (Sandbox Code Playgroud) 我有以下程序进入数据库并获取值,我已经执行了查询它也只给了我47行但是当我在控制台模式下运行相同的程序时它给了我 Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
package com.common;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Timestamp;
import java.sql.Types;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import com.common.Query;
public class GetColumnValuesFromDifferentTypes {
@SuppressWarnings("unused")
public static void printColumns(String query){
ABIDAO abidao = new ABIDAO();
int numberOfColumns=0,columnType = 0;
String columnValue = "", columnName = "";
Map<String, String> headerMap = new LinkedHashMap<String, String>();
Connection connection = abidao.getConnection();
if (connection != null) {
try {
headerMap = getHeader(query);
System.out.println("====================================================================");
System.out.println("Header …Run Code Online (Sandbox Code Playgroud) 我按照其他SO问题来设置URL的参数,但它给出了错误:
setQueryString(String)类型中的方法HttpMethodBase不适用于参数(NameValuePair[])
和
无法实例化该类型
NameValuePair.
我无法理解实际问题.有人可以帮我吗?
我从上面的问题中使用的代码
GetMethod method = new GetMethod("example.com/page";);
method.setQueryString(new NameValuePair[] {
new NameValuePair("key", "value")
});
Run Code Online (Sandbox Code Playgroud) 我尝试在运行时使用如下所示的反射查找字段类型的完全限定类型.
if(! Modifier.isFinal(f.getModifiers()) && type.equals(Integer.class)){
f.set(clsObject, DefaultParamValuesEnum.INTEGER.getDefaultInt());
}
Run Code Online (Sandbox Code Playgroud)
当我尝试以下枚举时,它会给出异常:
else if(! Modifier.isFinal(f.getModifiers()) && type.equals(enum.class)){
f.set(clsObject,DefaultParamValuesEnum.LONGVALUE.getDefaultLong());
}
Run Code Online (Sandbox Code Playgroud)
以下错误我得到:
Syntax error on token "enum", invalid
Run Code Online (Sandbox Code Playgroud)
如何弄清楚枚举类型?
请问有人帮助我.
int和之间有什么区别Integer.是的,一个是primitive另一个wrapper,正确使用它们的情况是什么.
还有什么区别:
int i=0;
++i
and
i++
Run Code Online (Sandbox Code Playgroud) 如何constraintName使用java从异常中提取,
catch(HibernateException e)
{
if (ExceptionChecker.isUniqueConstraintViolated(e))
{
if (log.isDebugEnabled()) {
log.debug("save HibernateException" + e.getMessage());
}
}
else
{
throw ExceptionHandler.handleHibernateException(this.getClass().toString(), log, e);
}
}
Run Code Online (Sandbox Code Playgroud)
上面是我的java代码捕获异常并且它执行了所需的异常,但是我得到了带有约束名称的约束违反异常,
我的问题是如何从抛出的异常中获取约束Name.
我试过这种方式,但它没有用 e.getMessage().split("**")[1]).toString()
谢谢
如何列出文件系统中可用的文件的起始编号和结束编号?
就好像有500文件在那里C:\Test\如何列出从1到20的文件一样
start number and end number根据此列表给出可用于特定文件路径的文件.
我在java中尝试这个
我试过这样的事情,它给了我给定路径的所有可用文件
public static List<String> loadAllFiles(String filesLocation) {
//find OS
//String osName = System.getProperty("os.name");
//replace file path based on OS
filesLocation = filesLocation.replaceAll("\\\\|/", "\\"+System.getProperty("file.separator"));
List<String> pdfFiles = new ArrayList<String>();
if (log.isDebugEnabled()) {
log.debug("In loadAllFiles execute start");
}
File directoryList = new File(filesLocation);
File[] filesList = directoryList.listFiles();
try {
for (int count = 0; count < filesList.length; count++) {
if (!filesList[count].isDirectory() && filesList[count].getName().endsWith(SPLIT_AND_SAVE_WORKING_FILE_EXTENSION.trim())) {
// load only PDF files …Run Code Online (Sandbox Code Playgroud)