当前位置:网站首页>判断一个字符串是否为空,如果为空,对其赋值,如果不为空,获取字符的个数并打印第一个字符
判断一个字符串是否为空,如果为空,对其赋值,如果不为空,获取字符的个数并打印第一个字符
2022-08-11 05:12:00 【余谦吖】
判断一个字符串是否为空,如果为空,对其赋值,如果不为空,获取字符的个数并打印第一个字符
package Day0712;
import java.util.Scanner;
/**
* 判断一个字符串是否为空,如果为空,对其赋值,如果不为空,获取字符的个数并打印第一个字符
*/
public class Five {
public static void main(String[] args) {
String say = "";
if (say.length() > 0){
int to = say.charAt(0);
System.out.println("字符的个数"+say.length()+"并打印第一个字符"+to);
}else {
say = "qqq";
System.out.println(say);
}
}
}
边栏推荐
- async(异步)和await的使用
- 02.折叠隐藏文字
- In the closing pages/uninstall (unload) sends a request to the server before the document
- 2022建筑焊工(建筑特殊工种)考题及模拟考试
- 批量修改数据库等视频文件名称
- HAVE FUN | “SOFA 星球”飞船计划、源码解析活动最新进展
- 你务必得明白——JSP的九大内置对象与四大域对象
- Switches and routers technology - 26 - configure OSPF peripheral area
- [QNX Hypervisor 2.2用户手册]10.16 vdev virtio-blk
- BGP Comprehensive Experiment
猜你喜欢
宝塔Linux环境下redis开启多端口
Switch and Router Technology-34-Dynamic NAT
HAVE FUN | “SOFA 星球”飞船计划、源码解析活动最新进展
元宇宙社交应用,靠什么吸引用户「为爱发电」?
C Language: Practical Debugging Tips
2021 Network Planning Designer Afternoon Case Questions
【嵌入式开源库】MultiButton的使用,简单易用的事件驱动型按键驱动模块
IDEA中配置checkstyle
Switches and routers technology - 26 - configure OSPF peripheral area
Win10远程连接(实现多用户同时连接)
随机推荐
[QNX Hypervisor 2.2 User Manual] 10.16 vdev virtio-blk
C语言题解:谁是凶手!
BGP综合实验
Switch and Router Technology - 25 - OSPF Multi-Area Configuration
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/data/xxxx
MyEclipse数据库工具使用教程:使用驱动程序
分库分表之sharding-proxy
Oracle中如何用一个表的数据更新另一个表中的数据_转载
BGP Comprehensive Experiment
Switches and routers technologies - 30 - standard acls
Tips to improve your productivity, you have to know - Navitcat shortcuts
JedisLock_Redis分布式锁实现_转载
Use Adobe genuine software for prostitution to reduce the slow employment and non-employment of fresh graduates
ARM Architecture 4: Embedded Hardware Platform Interface Development
Win10远程连接(实现多用户同时连接)
K8s Review Notes 7--K8S Implementation of Redis Standalone and Redis-cluster
群晖DS220+ 应用小笔记
02.折叠隐藏文字
Trilium使用总结
How to use svg-icon (svg-sprite-loader plugin)