如何从崇高文本中的十六进制回到文本版本?
我不小心将我的.css文件的编码改为了崇高文本中的十六进制.
我怎样才能找回普通文本.css?
class Test {
public static void main() {
String s1 = null + null; //shows compile time error
String s1 = null;
String s2 = s1 + null; //runs fine
}
}
Run Code Online (Sandbox Code Playgroud)
有人可以解释一下这种行为的原因吗?
的clone
上方法Object
,它创建的对象的精确副本,被声明为:
protected native Object clone() throws CloneNotSupportedException;
Run Code Online (Sandbox Code Playgroud)
为什么native
?
我们将注释定义为接口,如下所示
@interface annot_name {
}
Run Code Online (Sandbox Code Playgroud)
我们知道所有注释都java.lang.annotation.Annotation
默认扩展接口.
当我检查java库的Annotation
接口时,我发现它覆盖了许多Object类的方法,比如hashCode()
等.
如果Annotation是一个接口,那么它如何扩展Object类并覆盖其方法呢?接口只能扩展其他接口而不能扩展类.
class A {
static {
System.out.println("A-SIB");
}
static void test(){
System.out.println("A-test");
}
}
class B extends A {
static {
System.out.println("B-SIB");
}
}
class C {
public static void main(String args []){
B.test();
}
}
Run Code Online (Sandbox Code Playgroud)
当我跑C级时,我想A-SIB
,B-SIB
并且A-test
将被打印,但B-SIB
输出中没有.有人可以解释一下原因吗?
val a = List((2,5,1),(3,8,4), (5,4,3) ,(9,1,2))
Run Code Online (Sandbox Code Playgroud)
我希望输出作为一个不同的列表,它是基于列表中每个元组的中间元素的排序顺序,第一和第三元组的顺序不应该更改.它就像只交换第二个元组.
预期的答案是:
List((2,1,1), (3,4,4) , (5,5,3), (9,8,2))
Run Code Online (Sandbox Code Playgroud) 我使用scala解决了一个问题,我的解决方案是:
object ConsecutiveProduct extends App {
def getConsecutiveProduct(group: Int, number: String): Int = {
val result = number.sliding(group).map(product)
result.max
}
def product(number: String): Int = number.map(_.asDigit).product
val str = """73167176531330624919225119674426574742355349194934
|96983520312774506326239578318016984801869478851843
|85861560789112949495459501737958331952853208805511
|12540698747158523863050715693290963295227443043557
|66896648950445244523161731856403098711121722383113
|62229893423380308135336276614282806444486645238749
|30358907296290491560440772390713810515859307960866
|70172427121883998797908792274921901699720888093776
|65727333001053367881220235421809751254540594752243
|52584907711670556013604839586446706324415722155397
|53697817977846174064955149290862569321978468622482
|83972241375657056057490261407972968652414535100474
|82166370484403199890008895243450658541227588666881
|16427171479924442928230863465674813919123162824586
|17866458359124566529476545682848912883142607690042
|24219022671055626321111109370544217506941658960408
|07198403850962455444362981230987879927244284909188
|84580156166097919133875499200524063689912560717606
|05886116467109405077541002256983155200055935729725
|71636269561882670428252483600823257530420752963450""".filter(_.isDigit)
println(getConsecutiveProduct(5, str))
}
Run Code Online (Sandbox Code Playgroud)
所以根据问题,我必须计算最高的相邻数字产品,输入5个相邻数字的产品最高我得到的结果是正确的40824
,但根据问题,当我在这里通过13,println(getConsecutiveProduct(13, str))
即连续13位数的最高乘积我得到结果作为'2091059712',但它不是正确的答案,因为我试图在相应的网站输入,我尝试调试但无法找到我做错的地方,有人请帮忙.
我很难理解这种语法,
val grid = {
val input = """ 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
|49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
|81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
|52 70 95 23 04 60 11 42 69 24 68 …
Run Code Online (Sandbox Code Playgroud) 为什么if
有条件的评估true
在这个程序中?怎么10
相当于10.0
?
public class Test {
public static void main(String[] args) {
int i = 10;
double d = 10.0;
if (i == d) {
System.out.println("hi");
} else {
System.out.println("bye");
}
}
}
Run Code Online (Sandbox Code Playgroud) 我目前正在使用 intellij idea 对我正在处理的项目进行编码,在.jar
使用OneJar
命令创建文件后,我将 .jar 文件部署在我的 linux 服务器上,其地址类似于192.164.1.125
.there 我sudo nohup java -jar fileName.jar &
在服务器上运行命令以启动 jar 文件在后台并使用 rest-client 应用程序将 rest 调用发送到我的 .jar 文件。每当出现问题时,我只能在nohup.out
文件中看到错误消息,而我真正想要的是使用 intellij 想法调试我的 jar 文件,即我怎么能192.164.1.125
使用在我的客户端机器上运行的 IntellijIdea调试我的 .jar 。我知道我必须在 Intellij 的运行菜单中使用 EditConfigurations 选项并提供 IP 和端口,但如何准确地做到这一点。