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 ...
随机推荐
- 75.Android之基本架构
转载:http://www.cnblogs.com/lijunamneg/archive/2013/01/18/2866953.html Android其本质就是在标准的Linux系统上增加了Java ...
- js-this的用法,来自阮一峰老师的文章
1. 随着函数使用场合的不同,this的值会发生变化.但是有一个总的原则,那就是this指的是,调用函数的那个对象. 或者说,this指向当前执行的函数的所有者. 2.情况一:纯粹的函数调用 这是函数 ...
- Leetcode 347. Top K Frequent Elements
Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2 ...
- 【BZOJ-3626】LCA 树链剖分
3626: [LNOI2014]LCA Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 1428 Solved: 526[Submit][Status ...
- 警告 “util.NativeCodeLoader: Unable to load native-hadoop library for your platform”
http://blog.csdn.net/sagaryu/article/details/52137989 我的是2.6.4,用上面链接提供的编译好的资源覆盖原来的就好了. 不管也没事. 就是因为系统 ...
- SQL Server数据同步的研究(单向/双向)
思路: 1.做中间件(简单:定时采集:复杂:分布式,订阅中心的形式,如微信的中间件:https://github.com/tencent-wechat/phxsql) 2.采用触发器的形式,有数据触发 ...
- VS调试时同时启动多个项目解决方法
选中要设置的项目,不要右击里面的属性,而是按f4时显示属性,下面总是在调试时启动设为false.
- log4j属性详解
Log4j有三个主要的组件:Loggers(记录器),Appenders (输出源)和Layouts(布局).这里可简单理解为日志类别,日志要输出的地方和日志以何种形式输出.综合使用这三个组件可以轻 ...
- C#用正则表达式对IP进行排序
static void Main(string[] args) { string IPs = " 192.168.1.1 202.47.4.6 1.2.3.3 "; Console ...
- C#常用异常类记录
从MSDN抄下来的 ArgumentException 传递到方法的非空参数是无效的. ArgumentNullException 传递给方法的参数为空. ArgumentOutOfRangeExc ...