当前位置:网站首页>静态方法的缺失
静态方法的缺失
2022-08-02 14:16:00 【微生鸿朗】
错误结果:无法从静态上下文中引用,非静态方法
所使用的的代码是:
```java
package com.hhxx.array;
import java.util.Arrays;
public class BubbleSort02 {
public static void main(String[] args) {
int[] values = {
12, 45, 4, 2, 56, 688};
bubbleSort(values);
System.out.println(Arrays.toString(values));
}
private void bubbleSort(int[] values) {
int temp;
for (int i = 0; i < values.length - 1; i++) {
for (int j = values.length - 1; j > i; j--) {
if (values[j] > values[j - 1]) {
temp = values[j];
values[j] = values[j - 1];
values[j - 1] = temp;
}
}
}
}
}
具体错误点:

具体的解决办法是,提供一个静态方法,满足条件。
边栏推荐
猜你喜欢
内存和硬盘、磁盘的区别
Class template/assignment operations and add operations
OpenPose 基本理念
Technical Selection of Message Queuing
How to tick the word box?
SQL在MySQL中是如何执行的
Evaluation multipath weswood congestion control on ns3
【进程间通信】:管道通信/有名/无名
The relationship between base classes and derived classes [inheritance] / polymorphism and virtual functions / [inheritance and polymorphism] abstract classes and simple factories
分布式一致性协议-Gossip
随机推荐
Oauth2.0 resource server construction
mongodb连接本地服务失败的问题
【软件测试】进阶篇
字符数组/字符串数组|数组指针/指针数组/
GC垃圾收集器G1
Oauth2.0 Supplement
许多代码……
mininet multihomed topology
smart_rtmpd 的 VOD 接口使用说明
Xrdp 体验优化
queue的c实现
Doubly linked list (normal iterators and const iterators)
Vert.x web 接收请求时反序列化对象 Failed to decode 如何解决?
Oauth2.0 security (take WeChat authorized login as an example)
Xshell 使用删除键乱码问题
华为Mux VLAN 二层流量隔离
打包项目上传到PyPI
排序方法汇总(C语言)
【进程间通信】消息队列
【线程】线程创建 | 理解线程并发 (1)