Java Programming Test Question 2
2016-07-25 15:01
411 查看
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中execute executeUpdate executeQuery的区别
- 判断VIEW是否还在显示
- Java Programming Test Question 1
- EasyUI - 关于datagrid的idField的注意事项
- ue4 socket
- IOS中表视图(UITableView)使用详解
- [树状数组 逆序对] poj 2299 Ultra-QuickSort
- (一)通用工具之同步队列(sync_queue)
- SQLiteDataBase对象的query()接口:
- GUI应用程序架构的十年变迁:MVC,MVP,MVVM,Unidirectional,Clean
- 父view中添加手势子view不响应的问题解决
- Reveal UI 分析工具简单使用
- LeetCode 之Distinct Subsequences
- @RequestBody应用
- MySQL中char(36)被认为是GUID导致的BUG及解决方案
- LeetCode:347. Top K Frequent Elements
- javaEE:day9-request和response的转发、重定向、请求包含小细节
- Win10 上 安装Arduino 驱动 和 Arduino IDE 1.6.9
- Win10 上 安装Arduino 驱动 和 Arduino IDE 1.6.9
- Longest Increasing Subsequence Arrays (组合计数)