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 ...
随机推荐
- [51nod1515]明辨是非
Description 给$n$组操作,每组操作形式为$x\;y\;p$. 当$p=1$时,如果第$x$变量和第$y$个变量可以相等,则输出$YES$,并限制他们相等;否则输出$NO$,并忽略此次操作 ...
- 【BZOJ-1178】CONVENTION会议中心 倍增 + set (神思路好题!)
1178: [Apio2009]CONVENTION会议中心 Time Limit: 15 Sec Memory Limit: 162 MBSubmit: 812 Solved: 323[Subm ...
- 搜索表头的例子-jqueryEasyUi
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- Shell变量的定义与赋值操作注意事项
1 shell变量是弱类型 * 声明变量不用声明类型 * 可以存储不同类型的内容 * 使用时要明确变量的类型 * 区分大小写 2 变量声明及赋值格式 2.1 格式 变量名=变量值 # 注意等号两侧不 ...
- phpize报cannot find autoconf
突然想往php种增加个模块,可是又不想重新编译php,因为真的比较费时间. phpize就可以解决这个问题. 遇到的问题: Configuring for: PHP Api Version: Zend ...
- discuz /faq.php SQL Injection Vul
catalog . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 . 通过获取管理员密码 . 对管理员密码进行破解.通过在cmd5.com ...
- ASP.NET MVC4 执行流程
MVC在底层和传统的asp.net是一致的,在底层之上,相关流程如下: 1)Global.asax里,MvcApplication对象的Application_Start()事件中,调用 RouteC ...
- selenium.Phantomjs设置浏览器请求头
from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCap ...
- JS-window对象集合
知识点表格截图:
- 淘淘商城基于maven和svn的理解
首先了解下maven和svn是什么: Maven是一个项目的管理工具,它包含了一个项目对象模型 (Project Object Model),一组标准集合,一个项目的生命周期(Project Life ...