当前位置:网站首页>[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
边栏推荐
- C语言中函数参数传递的三种方式
- Night God simulator +fiddler packet capture test app
- Detailed explanation of cjson usage
- 300+ documents! This article explains the latest progress of multimodal learning based on transformer
- [Oracle final review] addition, deletion and modification of tablespaces, tables, constraints, indexes and views
- Esp32-c3 introductory tutorial question ⑩ - error: implicit declaration of function 'ESP_ blufi_ close‘;
- 揭秘得物客服IM全链路通信过程
- 第一次去曼谷旅游怎么玩?这份省钱攻略请收好
- 如何清理废弃pv和其对应的文件夹
- Meta universe chain game system development (logic development) - chain game system development (detailed analysis)
猜你喜欢

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

材质UV遮罩的技巧

第一次去曼谷旅游怎么玩?这份省钱攻略请收好

新加坡暑假旅遊攻略:一天玩轉新加坡聖淘沙島

Leetcode interview question 16.17 Continuous sequence

Looking for innocence in New York -- a beautiful day at the discovery center of Legoland, New Jersey

Thoroughly understand the point cloud processing tutorial based on open3d!

exness深度好文:动性系列-黄金流动性实例分析(五)

Web version 3D visualization tool, 97 things programmers should know, AI frontier paper | information daily # 2022.07.01

Installation of thingsboard, an open source IOT platform
随机推荐
第一次去曼谷旅游怎么玩?这份省钱攻略请收好
C语言中函数参数传递的三种方式
材质UV遮罩的技巧
Redis (6) -- object and data structure
快速排序基本思路(通俗易懂+例子)「建议收藏」
Is it safe to buy funds on Alipay account
Singapore summer tourism strategy: play Singapore Sentosa Island in one day
夜神模拟器+Fiddler抓包测试App
Implementation shadow introduction
Server PHP environment building tutorial, PHP server environment building graphic explanation
Introduction to sap s/4hana OData mock service
The difference between SLC, MLC, TLC and QLC NAND SSD: which is better?
Paddlepaddle 28 build an automatic coder based on convolution
哪个券商公司网上开户佣金低又安全又可靠
Tips for material UV masking
LightGroupButton* sender = static_cast<LightGroupButton*>(QObject::sender());
Radian to angle, angle to radian in MATLAB
MySQL about only_ full_ group_ By limit
【愚公系列】2022年07月 Go教学课程 001-Go语言前提简介
Ali was wildly asked by the interviewer on three sides. Redis dared not write 'proficient' on his resume anymore