当前位置:网站首页>[daily question] the next day
[daily question] the next day
2022-07-02 18:50:00 【No. 101 of the top 100 most handsome faces in the Asia Pacific 】
️ Author: intellectuals
️ Personal blog : Old nine CSDN Blog
Personal famous saying : Uncontrollable things Optimistic face
Series column : A daily topic
List of articles
choice


toLowerCase Not in itself , Instead, a new object is created , The underlying source code is new A new one string, And if it is lowercase , Just go back to this, Can't new A new object

First create a new object , Inside are static methods , Static methods don't depend on objects , So it can be compiled and run correctly

The constructor of the subclass must call the constructor of the parent class , If you use super() It shows the constructor of calling the parent class ,this and super Cannot appear in the same constructor , Nor in static Use in the environment , Because it depends on objects

The object that creates the subclass calls the constructor of the parent class by default

static Cannot define local variables , Only static member variables can be defined , Nor can it be placed in static methods

abstract Fields cannot be decorated
Abstract methods cannot be bracketed

Class constructor( Construction method ) It can be omitted , Constructor must have the same name as the class , But methods can also have the same name as classes , Constructors can be overloaded

The assignment of member variables must be implemented in methods

Programming questions 1

Reverse the overall data
Then reverse each word
public class test1 {
public static void reverse(char[] array,int start,int end){
while(start < end){
char tmp = array[start];
array[start] = array[end];
array[end] = tmp;
start ++;
end --;
}
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String s = scan.nextLine();
char[] ch = s.toCharArray();
int len = ch.length;
// The whole is reversed
reverse(ch,0,len-1);
int i = 0;// Traversal array
while(i<len){
int j = i;
while(j<len && ch[j] != ' '){
j++;
}
if(j<len){
reverse(ch,i,j-1);
i=j+1;
}else{
reverse(ch,i,j-1);
i= j;
}
}
String str = new String(ch);
System.out.println(str);
}
}
Programming questions 2


public class test1 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int [] array = new int[n+1];
for(int i = 0;i<n;i++){
array[i]=scan.nextInt();
}
int i = 0;
int count = 0;
while(i<n){
if(array[i]<array[i+1]){
while(i<n && array[i]<array[i+1]){
i++;
}
count++;
i++;
}else if(array[i] == array[i+1]){
i++;
}else{
while(i<n && array[i]>array[i+1]){
i++;
}
count++;
i++;
}
}
System.out.println(count);
}
}
————————————————————————
It's not easy to code words , Everyone's support is my driving force to stick to it
Copyright notice : This paper is about CSDN Blogger 「 The top 100 most handsome faces in the Asia Pacific region 101 name 」 The original article of
边栏推荐
- M2DGR:多源多场景 地面机器人SLAM数据集(ICRA 2022 )
- Websocket of Web real-time communication technology
- Leetcode (81) -- search rotation sort array II
- [Yugong series] July 2022 go teaching course 001 introduction to go language premise
- [Yugong series] July 2022 go teaching course 001 introduction to go language premise
- Deep learning mathematics foundation
- 故障排查:kubectl报错ValidationError: unknown field \u00a0
- iptable端口重定向 MASQUERADE[通俗易懂]
- 徹底搞懂基於Open3D的點雲處理教程!
- 什么是云原生?这回终于能搞明白了!
猜你喜欢

Hongmeng's fourth learning

Industrial software lecture - core technology analysis of 3D CAD design software - the second lecture of the Forum

在纽约寻找童真——新泽西州乐高乐园探索中心的美好一天

电商系统中常见的 9 大坑,你踩过没?

再放寬!這些應届生,可直接落戶上海

昨天阿里学长写了一个责任链模式,竟然出现了无数个bug

NM01-独立于总线协议的NM模块功能概述与API定义

A simple PHP personal card issuing program v4.0

阿里三面被面试官狂问Redis,简历上再也不敢写'精通'了

Stratégie touristique d'été de Singapour: un jour pour visiter l'île de San taosha à Singapour
随机推荐
如何优雅的写 Controller 层代码?
27: Chapter 3: develop Passport Service: 10: [registration / login] interface: after the registration / login is OK, save the user session information (uid, utoken) to redis and cookies; (one main poi
问题包含哪些环节
Leetcode 面试题 16.15. 珠玑妙算
Leetcode interview question 16.15 Abacus wonderful calculation
Troubleshooting: kubectl reports an error validationerror: unknown field \u00a0
距离度量 —— 杰卡德距离(Jaccard Distance)
Yesterday, Alibaba senior wrote a responsibility chain model, and there were countless bugs
Unity learning shader notes [82] black and white processing of enhanced single channel color rendering
第一次去曼谷旅游怎么玩?这份省钱攻略请收好
Simulateur nightGod + application de test de capture de paquets Fiddler
The student Tiktok publicized that his alma mater was roast about "reducing the seal of enrollment". Netizen: hahahahahahahaha
Paddlepaddle 28 build an automatic coder based on convolution
Chain game system development (unity3d chain game development details) - chain game development mature technology source code
UML 类图
How to write controller layer code gracefully?
服务器php环境搭建教程,PHP服务端环境搭建图文详解
夜神模拟器+Fiddler抓包测试App
Comprendre complètement le tutoriel de traitement de Point Cloud basé sur open3d!
The text editor hopes to mark the wrong sentences in red, and the text editor uses markdown