本文介绍了关于功能的简单问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public class test {
	private Node head;

	private class Node{
		int p;
		Node next;

		public Node(int p, Node next) {
			this.p = p;
			this.next = next;
		}
	}

	public void set() {
		set(head);
	}

	private void set(Node p) {
		p = new Node(1, null);
	}

	public boolean isEmpty() {
		return head == null;
	}

	public static void main(String[] args) {
		test a = new test();
		a.set();
		System.out.println(a.isEmpty());
	}
}





set()函数calss set(head),然后我认为p = head ,和私人集(节点p)



如果要初始化头部,但事实是头部没有初始化,所以我知道为什么



the set() fuction calss set(head), then i think p = head, and the private set(Node p)

if to initialize the head, but the fact is that head is not initialized, so i what to know why

推荐答案


这篇关于关于功能的简单问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 21:26