我正在尝试使用此代码:
private static Date getTimeStamp() {
return new Timestamp(new Date().getTime());
}
Run Code Online (Sandbox Code Playgroud)
我得到的是 2013-03-13 12:46:22.011
但我需要的是时间戳应采用格式mm-dd-yyyy hh:mm.
我有一个div标签,其中包含一个标签.我怎样才能获得价值href?
例如,标签中的" https://www.tweeter.com/rkShukl " <a>:
<a href="https://www.tweeter.com/rkShukl"></a>
Run Code Online (Sandbox Code Playgroud) 我正在从数据库中检索字符串并将其存储到for循环内的String变量中.我正在检索的几个字符串的形式为:
https://www.ppltalent.com/test/en/soln-computers-ltd
很少有人的形式
https://www.ppltalent.com/test/ja/aman-computers-ltd
我希望将字符串分成两个子串,即
https://www.ppltalent.com/test/en/soln-computers-ltdas https://www.ppltalent.com/test/en和/soln-computers-ltd.
如果我只有它,它可以很容易地分开/en.
String[] parts = stringPart.split("/en");
System.out.println("Divided String : "+ parts[1]);
Run Code Online (Sandbox Code Playgroud)
但在它的许多字符串中/jr,/ch等等.
那么如何将它们分成两个子字符串呢?
我有一个名为Employee的类,它映射到employee.hbm.xml.我有一个新的要求,我应该有一个历史表,即Employee_history,它应该使用lastUpdated和dateCreated等新的额外字段保留Employee表的记录.当我在Employee中创建或更新新记录时,它也应该更新到Employee_History表中.那么应该采用哪种更好的方法呢?我非常擅长冬眠,或者可以说今天就开始了.任何帮助都将受到高度赞赏.
我是java新手,只是为了学习目的编写了一个程序.我有两个字符串数组,我想比较两个字符串数组的长度.如果长度相等,则将每个第一个字符串数组的值与每个第二个数组的值进行比较.如果值匹配则打印该值.无法纠正问题所在?
package com.equal.arrat;
import java.util.ArrayList;
import java.util.List;
public class ArrayEqual {
public static void main(String[] args) {
String s[] = {"anuj","kr","chaurasia"};
String s1[] = {"anuj","kr","chaurasia"};
if (s.length==s1.length)
{
System.out.println(s.length);
for (int i =0 ; i>=s.length;i++)
{
for (int j =0 ;j>=s1.length;j++)
{
System.out.println("test");
if (s[i].equals(s1[j]))
{
System.out.println("ok" + s[i]);
}
else{
System.out.println("not ok");
}
}
}
}
else{
System.out.println("Length Not Equal");
}
}
}
Run Code Online (Sandbox Code Playgroud)