我无法指出getFreeSpace()和阶级getUsableSpace()方法之间的确切区别File.当我运行以下代码时,得到相同的o/p.
Class Start {
public static void main(String [] args) {
File myfile = new File("C:\\html\abc.txt");
myfile.createNewFile();
Systyem.out.println("free space"+myfile.getFreeSpace()+"usable space"+myfile.getUsableSpace());")
}
}
Run Code Online (Sandbox Code Playgroud)
O/P是
免费space445074731008可用空间445074731008
谁能告诉我究竟有什么区别?
get()和load()方法有什么区别?关于数据获取方法
public static void main(String[] args) {
SessionFactory factory= new Configuration().configure().buildSessionFactory();
Session session = factory.openSession();
Transaction tx = null;
tx = session.beginTransaction();
System.out.println("1 st time calling load method");
Account acc =
(Account)session.load(Account.class, 180);
System.out.println("bal"+acc.getBalance());
System.out.println("2nd time calling load method");
Account acc1=(Account)session.load(Account.class, 180);
System.out.println("bal"+acc1.getBalance());
System.out.println("1 st time calling get method");
Account acc2= (Account) session.get(Account.class, accId);
System.out.println("bal"+acc2.getBalance());
System.out.println("2 st time calling get method");
Account acc2= (Account) session.get(Account.class, accId);
System.out.println("bal"+acc2.getBalance());
tx.commit();
session.close();
Run Code Online (Sandbox Code Playgroud)
}
我得到了以下输出
1 st time calling load method
Hibernate:
/* load …Run Code Online (Sandbox Code Playgroud) 我试图编译以下代码但是出错了
static void test(long... x)
{
System.out.println("long...");
}
static void test(Integer... x)
{
System.out.println("Integer...");
}
public static void main(String [] args) {
int no=5;
test(no,no);//getting error at this point in eclipse 'The method test(long[]) is ambiguous '
}
Run Code Online (Sandbox Code Playgroud)
我不知道为什么它含糊不清.意味着如果我传递一个int值它应该自动框并test(Integer..x)应该被调用..类似的行test(long..x )应该被调用..这是我的理解..有人可以解释为什么它是模棱两可的?
我想创建自定义文件上传组件.我在html中执行了以下代码
HTML代码
<input id="upload" type="file" style="display: none;">// don`t want to render default
<button class="parimarybtnVD" type="button" ng-click="clickUpload()">Browse</button>
Run Code Online (Sandbox Code Playgroud)
JS代码
$scope.clickUpload = function() {
angular.element('#upload').trigger('click');
};
Run Code Online (Sandbox Code Playgroud)
但是当我点击"按钮"时出现以下错误.
Error: [$rootScope:inprog] http://errors.angularjs.org/1.2.16/$rootScope/inprog?p0=%24apply
at Error (<anonymous>)
at http://localhost:7001/RightsWeb/scripts/resource/angular.min.js:6:450
at l (http://localhost:7001/RightsWeb/scripts/resource/angular.min.js:102:171)
at h.$digest (http://localhost:7001/RightsWeb/scripts/resource/angular.min.js:105:497)
at HTMLDocument.D (http://localhost:7001/RightsWeb/scripts/utill/ui-bootstrap-tpls-0.11.0.min.js:9:14775)
at HTMLDocument.f.event.dispatch (http://localhost:7001/RightsWeb/extResources/jquery/jquery-1.7.1.min.js:3:4351)
at HTMLDocument.h.handle.i (http://localhost:7001/RightsWeb/extResources/jquery/jquery-1.7.1.min.js:3:328)
at Object.f.event.trigger (http://localhost:7001/RightsWeb/extResources/jquery/jquery-1.7.1.min.js:3:3038)
at <error: TypeError: Accessing selectionDirection on an input element that cannot have a selection.>
at Function.e.extend.each (http://localhost:7001/RightsWeb/extResources/jquery/jquery-1.7.1.min.js:2:11937)
Run Code Online (Sandbox Code Playgroud)
谁能告诉我为什么我会收到这个错误?如果有更好的方法在angularjs上进行自定义文件上传请告诉.谢谢你提前.
我是angularjs的新手.我正面临一个问题.我有一个带一个单选按钮的桌子.当用户选择任何单选按钮并单击提交按钮时,我需要显示所选行的详细信息.
Html代码:
<table>
<thead>
<tr>
<th>Select</th>
<th>First Name</th>
<th>Last Name</th>
<th>Unique Reference ID</th>
<th>Country</th>
<th>Branch</th>
<th>Card No</th>
</tr>
</thead>
<tr ng-repeat="d in Employees">
<td><input type="radio"></td>
<td>{{d.fname}}</td>
<td>{{d.lname}}</td>
<td>{{d.uniqueid}}</td>
<td>{{d.country.name}}</td>
<td> {{d.branch.name}}</td>
<td>{{d.cardno}}</td>
</tr>
</table>
<table>
<tr>
<td><input type="button" value="Edit" ng-click="Edit()"></td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
控制器代码:
$scope.Edit=function()
{
//need id of selected row ?
};
Run Code Online (Sandbox Code Playgroud) 我对String的实习方法没有很好的理解.
String s1="java"; // should create one object in String Constant pool
String ss="java"; // no object is created (java is already in String pool)..it refers to object in String constant pool
String s2= new String("Android").intern(); // should create 2 objects one in heap and second in String constant pool
String s3= new String("java").intern()// i guess only one object is created on heap and s3 will point to object in String constant pool (as 'java' already exist).so the object in …Run Code Online (Sandbox Code Playgroud) 我想知道从链接哈希集中删除元素的不同方法.我试过以下代码
LinkedHashSet<String> lhs = new LinkedHashSet<String>();
for(int i=0;i<10;i++)
lhs.add(String.valueOf(i));
Iterator<String> it=lhs.iterator();
System.out.println("removed?=="+lhs.remove("1"));
while(it.hasNext())
{
System.out.println("lhs"+it.next());
}
Run Code Online (Sandbox Code Playgroud)
我得到了以下输出
removed?==true
Exception in thread "main" java.util.ConcurrentModificationException
at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(Unknown Source)
at java.util.LinkedHashMap$KeyIterator.next(Unknown Source)
at preac.chapter1.Start.main(Start.java:321)
Run Code Online (Sandbox Code Playgroud)
我想念的是什么?提前致谢.
PS我也试过iterator.remove()方法,但得到了非法状态异常
编辑
我刚才知道我必须使用iterator remove方法.然后使用Link Hash Set删除方法是什么?在哪些情况下我们应该使用这种方法?
我知道'between'运算符包含指定的范围.但在下面的情况下,它的工作方式不同
我有表客户具有以下属性.
customer
{
customername varchar2(30),
custid integer(10,0)
}
Run Code Online (Sandbox Code Playgroud)
询问
select * from customer c where c.customername between 'a' and 'b';
Run Code Online (Sandbox Code Playgroud)
以上查询仅提取数据,以"a"开头的客户名称.但是当我们使用'between'运算符和数字时,两者都是包容性的.任何人都可以向我解释这个行为.