为什么Java类的第一个字母应该是大写的?是否无法运行包含低级类名的程序?如果有可能,有什么区别?
我是Windows用户.但根据我的项目要求,我需要编写Linux Shell Script(Bash shell).如何在Windows上开发Linux Shell?
有没有用于编写Linux Shell Scripting的IDE?请与我分享一些想法和资源链接.
我有一个包含许多分支的远程存储库.例如,我的存储库名称是:
http://navis.com/MyRepo.git
Run Code Online (Sandbox Code Playgroud)
它的分支是:
development
production (master)
testing
Run Code Online (Sandbox Code Playgroud)
我想将development分支合并到production(主)分支中.任何人都可以共享一个Git命令来合并两个远程分支吗?
我可以使用一些关于什么时候使用Joda Time而不是基本的java.util.Date类的指导.有什么好处?Joda Time是否允许您使用Date类做任何事情,或者它更容易使用或什么?
此外,我已经看到有关Joda Time是否是标准API的一部分的相互矛盾的信息.是标准还是不标准?
我有这门课:
public class Stack {
private class Node {
String item;
Node next;
}
// some other methods here
}
Run Code Online (Sandbox Code Playgroud)
在我的书中,作者说每个堆栈节点的大小是40个字节,包括:
16 bytes (object overhead)
8 bytes (inner class extra overhead)
8 bytes (references to string)
8 bytes (references to node)
----------------------------------------------
40 bytes per stack node
Run Code Online (Sandbox Code Playgroud)
据我所知,最后两件事指的是String和Node的引用大小.但我不知道object overhead和inner class extra overhead对应的是什么.你能解释一下吗?
您能否让我了解javaEE应用程序中APP-INF和WEB-INF文件夹之间的主要区别.
谢谢
我了解了Java 8新功能Lambda表达式.所以这是我使用Lambda表达式的"HelloWorld"类
public class LambdaHelloWorld {
interface HelloWorld {
String sayHello(String name);
}
public static void main(String[] args) {
HelloWorld helloWorld = (String name) -> { return "Hello " + name; };
System.out.println(helloWorld.sayHello("John Doe"));
}
}
Run Code Online (Sandbox Code Playgroud)
这种风格与Groovy封闭非常相似.这是时髦的"HelloWorld"
def sayHello(name) {
println("Hello $name!")
}
def clos = {name -> sayHello(name)} clos.call('John Doe')
Run Code Online (Sandbox Code Playgroud)
我认为这两个代码之间的差异较小.是不是Java Lambda表达式与Groovy闭包的逻辑或风格类似?
我有以下课程,请参阅
public class Go {
public static void main(String args[]) {
System.out.println("G" + "o");
System.out.println('G' + 'o');
}
}
Run Code Online (Sandbox Code Playgroud)
这是编译结果;
Go
182
Run Code Online (Sandbox Code Playgroud)
为什么我的输出包含数字?
以下是Oracle JavaEE 6教程文档中的引用,用于在JSF 2中传递值表达式和方法表达式中的参数.
值表达式和方法表达式都支持参数.在以下示例中,它是guessNumber应用程序的修改标记,提供随机数作为参数,而不是从方法调用的用户输入:
<h:inputText value="#{userNumberBean.userNumber('5')}">
Run Code Online (Sandbox Code Playgroud)
上面的示例使用值表达式.
这是默认的:
<h:inputText value="#{userNumberBean.userNumber}">
豆类 -
import java.util.Random;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean
@SessionScoped
public class UserNumberBean {
Integer randomInt = null;
Integer userNumber = null;
public UserNumberBean() {
Random randomGR = new Random();
randomInt = new Integer(randomGR.nextInt(10));
System.out.println("Duke's number: " + randomInt);
}
public void setUserNumber(Integer user_number) {
userNumber = user_number;
}
public Integer getUserNumber() {
return userNumber;
}
}
Run Code Online (Sandbox Code Playgroud)
以下表达式未将5作为参数传递给inputText:
<h:inputText value="#{userNumberBean.userNumber('5')}">
它实际上在运行时导致错误.
我的问题:我如何实现这一目标?
我玩java.math.BigInteger.这是我的java类,
public class BigIntegerTest{
public static void main(String[] args) {
BigInteger fiveThousand = new BigInteger("5000");
BigInteger fiftyThousand = new BigInteger("50000");
BigInteger fiveHundredThousand = new BigInteger("500000");
BigInteger total = BigInteger.ZERO;
total.add(fiveThousand);
total.add(fiftyThousand);
total.add(fiveHundredThousand);
System.out.println(total);
}
}
Run Code Online (Sandbox Code Playgroud)
我认为结果是555000.但实际是0.为什么?