Java中No enclosing instance of type X is accessible报错

Java编写代码过程中遇到了一个问题,main方法中创建内部类的实例时,编译阶段出现错误,查看错误描述: Multiple markers at this line - The value of the local variable test is not used - No enclosing instance of type StaticCallDynamic is accessible. Must qualify the allocation with an enclosing instance of type StaticCallDynamic (e.g...
Java基础 | 2017-05-28 18:11 | 阅读 2428 次 | 评论 0 条

Java用户登录验证

public class passwordVerify { public static void main(String[] args) { // TODO Auto-generated method stub verify(); } public static void verify() { String originalUserName = "cs1053283896@gmail.com" ; //账号密码信息 String originalUserPassword = "123456789" ; Scanner myscanner = new...
Java基础 | 2017-05-28 13:44 | 阅读 1547 次 | 评论 0 条

Java字符串的常用方法

public static void main(String[] args) { // TODO Auto-generated method stub String aString = "hellocensi @gmail.com " ; System.out.println(aString); int lenthString=aString.length(); System.out.println("way1:"+lenthString);//常用方法1:获取字符串长度 char str[]=aString.toCharArray(); //常用方法2 :...
Java基础 | 2017-05-28 12:21 | 阅读 1732 次 | 评论 0 条

约瑟夫问题单向循环链表解决简版

#include<stdio.h> #include<stdlib.h> #define N 13 //总人数 typedef struct Node { int Data; struct Node *Next; }List,*Position; Position Create(void); Position Delete(Position Head,Position P); Position Deal(Position Head); void Traverse(Position Head); int main() //测试 { P...
c++基础 | 2017-05-27 23:12 | 阅读 1731 次 | 评论 0 条

保留n位小数的方法

public static void main(String[] args) { double sprt20=Math.sqrt(20); sprt20=(float)Math.round(sprt20*10000)/10000.0; //关键:10^n,n表示小数点后位数,且后面的10^n须带一位小数点 System.out.print(sprt20); } 结果:4.4721
Java基础 | 2017-05-23 13:12 | 阅读 1198 次 | 评论 0 条

C++实现的红黑树基本操作(English notes very cool!!)

#include<iostream> #include<cstdlib> using namespace std; #define RED 1 #define BLACK 0 typedef struct TreeNode { int Element; int Color; TreeNode *Parent; TreeNode *Left; TreeNode *Right; TreeNode() { Color=BLACK; //let initial node become black } }*MyRBTree; MyRBTree ...
c++基础 | 2017-05-09 21:41 | 阅读 1735 次 | 评论 1 条