java练习---7
//程序员:罗元昊 2017.10.7
import java.util.Scanner;
public class L { public static void main(String[] args) {
System.out.println("5+5="++); int a=,b;
b=a++;
System.out.println("a="+a+",b="+b); short c=;
c=(short) (c+);
System.out.println("c="+c); short d=;
d+=;
System.out.println("d="+d); System.out.println(&);
System.out.println(|);
System.out.println(^);
System.out.println(<<);
System.out.println(>>); int e=,f;
f=e>?:;
System.out.println("f="+f); @SuppressWarnings("resource")
Scanner input=new Scanner(System.in);
int g,h;
System.out.println("Enter the g ");
g=input.nextInt();
System.out.println("Enter the h ");
h=input.nextInt();
h=g>h?g:h;
System.out.println("The larger of the two numbers is"+h); @SuppressWarnings("resource")
Scanner input1=new Scanner(System.in);
int x,y,z;
System.out.println("Enter the x ");
x=input1.nextInt();
System.out.println("Enter the y ");
y=input1.nextInt();
System.out.println("Enter the z ");
z=input1.nextInt();
y=x>y?x:y;
z=y>z?y:z;
System.out.println("The largest of the three numbers is"+ z); @SuppressWarnings("resource")
Scanner input11=new Scanner(System.in);
int month;
System.out.println("Enter the month ");
month=input11.nextInt();
if(month>=&&month<=){
System.out.println("This month is spring");
}
else if(month>=&&month<=){
System.out.println("This month is summer");
}
else if(month>=&&month<=){
System.out.println("This month is autumn");
}
else if(month==){
System.out.println("This month is winter");
}
else if(month>=&&month<=){
System.out.println("This month is winter");
}
else{
System.out.println("Error!");
} @SuppressWarnings("resource")
Scanner input111=new Scanner(System.in);
int month1;
System.out.println("Enter the month ");
month1=input111.nextInt();
switch (month1)
{
case : case : case :
System.out.println("This month is winter");
break;
case : case : case :
System.out.println("This month is spring");
break;
case : case : case :
System.out.println("This month is summer");
break;
case : case : case :
System.out.println("This month is autumn");
break;
default:
System.out.println("Error!");
break;
} int i=;
do{
System.out.println("i="+i);
i++;
}while(i<); int j=;
while(j<){
System.out.println("j="+j);
j++;
} for(int k=;k<;k++)
{
System.out.println("k="+k);
} int q=;
for(System.out.println("a");q<;System.out.println("c"))
{
System.out.println("d");
q++;
}
}
}

java练习---7的更多相关文章
- Spark案例分析
一.需求:计算网页访问量前三名 import org.apache.spark.rdd.RDD import org.apache.spark.{SparkConf, SparkContext} /* ...
- 故障重现(内存篇2),JAVA内存不足导致频繁回收和swap引起的性能问题
背景起因: 记起以前的另一次也是关于内存的调优分享下 有个系统平时运行非常稳定运行(没经历过大并发考验),然而在一次活动后,人数并发一上来后,系统开始卡. 我按经验开始调优,在每个关键步骤的加入如 ...
- Elasticsearch之java的基本操作一
摘要 接触ElasticSearch已经有一段了.在这期间,遇到很多问题,但在最后自己的不断探索下解决了这些问题.看到网上或多或少的都有一些介绍ElasticSearch相关知识的文档,但个人觉得 ...
- 论:开发者信仰之“天下IT是一家“(Java .NET篇)
比尔盖茨公认的IT界领军人物,打造了辉煌一时的PC时代. 2008年,史蒂夫鲍尔默接替了盖茨的工作,成为微软公司的总裁. 2013年他与微软做了最后的道别. 2013年以后,我才真正看到了微软的变化. ...
- 故障重现, JAVA进程内存不够时突然挂掉模拟
背景,服务器上的一个JAVA服务进程突然挂掉,查看产生了崩溃日志,如下: # Set larger code cache with -XX:ReservedCodeCacheSize= # This ...
- 死磕内存篇 --- JAVA进程和linux内存间的大小关系
运行个JAVA 用sleep去hold住 package org.hjb.test; public class TestOnly { public static void main(String[] ...
- 【小程序分享篇 一 】开发了个JAVA小程序, 用于清除内存卡或者U盘里的垃圾文件非常有用
有一种场景, 手机内存卡空间被用光了,但又不知道哪个文件占用了太大,一个个文件夹去找又太麻烦,所以我开发了个小程序把手机所有文件(包括路径下所有层次子文件夹下的文件)进行一个排序,这样你就可以找出哪个 ...
- Java多线程基础学习(二)
9. 线程安全/共享变量——同步 当多个线程用到同一个变量时,在修改值时存在同时修改的可能性,而此时该变量只能被赋值一次.这就会导致出现“线程安全”问题,这个被多个线程共用的变量称之为“共享变量”. ...
- Java多线程基础学习(一)
1. 创建线程 1.1 通过构造函数:public Thread(Runnable target, String name){} 或:public Thread(Runnable target ...
- c#与java的区别
经常有人问这种问题,用了些时间java之后,发现这俩玩意除了一小部分壳子长的还有能稍微凑合上,基本上没什么相似之处,可以说也就是马甲层面上的相似吧,还是比较短的马甲... 一般C#多用于业务系统的开发 ...
随机推荐
- python合并多个文件
import os filelist=os.listdir('/root/Music') for item in filelist: print item newfile=open('/root/Mu ...
- spring 5.x 系列第20篇 ——spring简单邮件、附件邮件、内嵌资源邮件、模板邮件发送 (代码配置方式)
源码Gitub地址:https://github.com/heibaiying/spring-samples-for-all 一.说明 1.1 项目结构说明 邮件发送配置类为com.heibaiyin ...
- 教妹子用IDEA创建web应用,部署到Tomcat服务器
自从上一篇原创发表之后,粉丝反应热烈.主要分两派,一派关注技术的,觉得看了那么多的公众号文章,终于找到一篇能看懂的了,于是沾沾自喜.另一派是关注妹子的,感叹自己空有一身绝技,公司里却无妹子可教,大喊可 ...
- 【HDU - 2181】哈密顿绕行世界问题(dfs+回溯)
-->哈密顿绕行世界问题 Descriptions: 一个规则的实心十二面体,它的 20个顶点标出世界著名的20个城市,你从一个城市出发经过每个城市刚好一次后回到出发的城市. Input 前2 ...
- java 中的一些运算符问题
逻辑运算符 && 与 &: 在这二个与运算符中,一般用于if的判断中,A&&B,假设A的条件不满足时 则不会去判断后面的B, 如果A满足条件时就会接下来去做B条 ...
- C#学习笔记:ListBox控件的用法
样式如下: 实现的代码一: using System;using System.Collections.Generic;using System.ComponentModel;using System ...
- CDH 5.15.2 离线安装
一.前置准备 1. 基础信息 1.1 机器 机器名 服务 hadoop1 主节点 hadoop2 data.task hadoop3 data.task 1.2 服务版本 服务 版本 cdh 5.15 ...
- os.path.dirname(__file__)
os.path.dirname(__file__) 返回脚本的路径 描述: 必须实际存在的.py文件,如果直接在命令行执行,则会引发异常NameError: name 'file' is not de ...
- django基础知识之模板继承:
模板继承 模板继承可以减少页面内容的重复定义,实现页面内容的重用 典型应用:网站的头部.尾部是一样的,这些内容可以定义在父模板中,子模板不需要重复定义 block标签:在父模板中预留区域,在子模板中填 ...
- H5学习笔记-应用缓存,Web worker,服务器发送事件
↑亮了 应用缓存用法 <!DOCTYPE HTML> <html manifest="demo.appcache"> <body> The co ...