Java Programming Test Question 2
public class JPTQuestion2 {
public static void main(String[] args) {
String s3 = "JournalDev";
int start = 1;
char end = 5;
System.out.println(start + end);
System.out.println(s3.substring(start, end));
}
}
注意:这里的end是char类型,可是,输出结果和int型的end没区别。
原因:...........
官方解释:
Java Programming Test Question 2 Answer and Explanation
The given statements output will be ourn. First character will be automatically type caste to int. After that since in java first character index is 0, so it will start from o and print till n. Note that in String substring function it leaves the end index.
Java Programming Test Question 2的更多相关文章
- Java Programming Test Question 3
import java.util.HashSet; public class JPTQuestion3 { public static void main(String[] args) { HashS ...
- Java Programming Test Question 1
public class JPTQuestion1 { public static void main(String[] args) { String s1 = "abc"; St ...
- Java Programming Test Question 4
What will be the boolean flag value to reach the finally block? public class JPTQuestion4 { public s ...
- Java programming language compiler
https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html\ javac - Java programming l ...
- Java Programming Language Enhancements
引用:Java Programming Language Enhancements Java Programming Language Enhancements Enhancements in Jav ...
- 文本信息“welcome to java programming!”
import javax.swing.JOptionPanepublic class welcome {public static void main(string[] arg){JOptionPan ...
- C Programming vs. Java Programming
Thing C Java type of language function oriented object oriented basic programming unit function clas ...
- Difference Between Arraylist And Vector : Core Java Interview Collection Question
Difference between Vector and Arraylist is the most common Core Java Interview question you will co ...
- Java Programming Guidelines
This appendix contains suggestions to help guide you in performing low-level program design and in w ...
随机推荐
- 【BZOJ-3572】世界树 虚树 + 树形DP
3572: [Hnoi2014]世界树 Time Limit: 20 Sec Memory Limit: 512 MBSubmit: 1084 Solved: 611[Submit][Status ...
- Linux中/etc/hosts文件总是被自动修改
关闭NetworkManager服务即可. 临时关闭: service NetworkManager stop 永久关闭: chkconfig NetworkManager off 在centos6 ...
- bzoj3295: [Cqoi2011]动态逆序对(cdq分治)
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #i ...
- wpf配置菜单栏
WPF 内建了两种菜单——Menu 和ContextMenu(上下文菜单). 1. Menu Menu 的项可以是任何东西,但是你应该使用MenuItem 以及Separator 对象. <Me ...
- Linux-小命令技巧
在bash中检查远程端口是否打开:echo >/dev/tcp/8.8.8.8./53 && echo "open"将进程挂起ctrl+z,不是万能的,有程序 ...
- 细解ListView之自定义适配器
下面我们将以一个例子来讲述ListView之自定义适配器 首先我们看一下效果图: [分析] 首先:需要创建一个ListView控件,自定义适配器是为了实现自定义ListView的ListView_It ...
- Zabbix网络自动发现规则和自动添加hosts及link模板
Version: zabbix 3.0 一.配置网络发现规则 Device uniqueness criteria:选择主机名作为唯一标识(Configuation Hosts中显示的NAME) 二. ...
- Codeforces 711E ZS and The Birthday Paradox
传送门 time limit per test 2 seconds memory limit per test 256 megabytes input standard input output st ...
- Mac下同时安装多个版本的JDK
JDK8 GA之后,小伙伴们喜大普奔,纷纷跃跃欲试,想体验一下Java8的Lambda等新特性,可是目前Java企业级应用的主打版本还是JDK6, JDK7.因此,我需要在我的电脑上同时有JDK8,J ...
- POJ3208:Apocalypse Someday
传送门 很神奇的一道题,正解是AC自动机+数位DP,个人感觉POPOQQQ大爷的方法更方便理解. 按照一般套路,先搞个DP预处理,设$f[i][0/1/2/3]$分别表示对于$i$位数,其中有多少个前 ...