public Hero(String name, int age) { this.name = name; this.age = age; } }
static Hero[] heroes = { new Hero("Grelber", 21), new Hero("Roderick", 12), new Hero("Francisco", 35), new Hero("Superman", 65), new Hero("Jumbletron", 22), new Hero("Mavericks", 1), new Hero("Palladin", 50), new Hero("Athena", 50) };
public static void main(String[] args) {
long adultYearsExperience = Arrays.stream(heroes).filter(b -> b.age >= 18) .mapToInt(b -> b.age).sum(); System.out.println("We're in good hands! The adult superheros have " + adultYearsExperience + " years of experience");
List
运行结果:
We're in good hands! The adult superheros have 243 years of experience
Heroes by name: [Athena, Francisco, Grelber, Jumbletron, Mavericks, Palladin, Roderick, Superman]
java的多态性是指main方法在调用属性的时候类可以对这一属性做出反应的情况
//package 1;
class A{
public void test(){
System.out.println("A");
}
}
class D extends A{
public void test(){
S
参考了网上的思路,写了个Java版的:
public class Fibonacci {
final static int[] A={1,1,1,0};
public static void main(String[] args) {
int n=7;
for(int i=0;i<=n;i++){
int f=fibonac
1、查看系统客户端,数据库,连接层的编码
查看方法: http://daizj.iteye.com/blog/2174993
进入mysql,通过如下命令查看数据库编码方式: mysql> show variables like 'character_set_%'; +--------------------------+------
public class MyQueue {
private long[] arr;
private int front;
private int end;
// 有效数据的大小
private int elements;
public MyQueue() {
arr = new long[10];
elements = 0;
front
A binary search tree (BST) is a binary tree where each node has a Comparable key (and an associated value) and satisfies the restriction that the key in any node is larger than the keys in all