当前位置:网站首页>[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
边栏推荐
- 链游系统开发(Unity3D链游开发详情)丨链游开发成熟技术源码
- After 22 years in office, the father of PowerShell will leave Microsoft: he was demoted by Microsoft for developing PowerShell
- Industrial software lecture - core technology analysis of 3D CAD design software - the second lecture of the Forum
- A simple PHP personal card issuing program v4.0
- What are the links of the problem
- Leetcode 面试题 16.15. 珠玑妙算
- [Oracle final review] addition, deletion and modification of tablespaces, tables, constraints, indexes and views
- QQmlApplicationEngine
- UML 类图
- Singapore summer tourism strategy: play Singapore Sentosa Island in one day
猜你喜欢
![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](/img/b9/2066a13b160252114c2881007094f8.png)
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

Hongmeng's fourth learning

Leetcode 面试题 17.04. 消失的数字

Singapore summer tourism strategy: play Singapore Sentosa Island in one day

What is cloud primordial? This time, I can finally understand!

Exness in-depth good article: dynamic series - Case Analysis of gold liquidity (V)

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

UML class diagram

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

Night God simulator +fiddler packet capture test app
随机推荐
Exness in-depth good article: dynamic series - Case Analysis of gold liquidity (V)
呆错图床系统源码图片CDN加速与破J防盗链功能
After 22 years in office, the father of PowerShell will leave Microsoft: he was demoted by Microsoft for developing PowerShell
Installation of thingsboard, an open source IOT platform
The student Tiktok publicized that his alma mater was roast about "reducing the seal of enrollment". Netizen: hahahahahahahaha
StretchDIBits函数
Unity learning shader notes [82] black and white processing of enhanced single channel color rendering
Redis(6)----对象与数据结构
How to enable the run dashboard function of idea
What is cloud primordial? This time, I can finally understand!
Leetcode 面试题 17.01. 不用加号的加法
PR曲线和ROC曲线概念及其区别
Leetcode interview question 16.11 Diving board
[Yugong series] July 2022 go teaching course 001 introduction to go language premise
In early summer, Kaiyuan magic changed an electric mosquito racket with killing sound effect!
options should NOT have additional properties
AI开发调试系列第二弹:多机分布式调测探索之旅
文字编辑器 希望有错误的句子用红色标红,文字编辑器用了markdown
CDN acceleration and breaking J anti-theft chain function
学生抖音宣传母校被吐槽“招生减章”,网友:哈哈哈哈哈哈