zookeeper的根节点在哪里找不到求指教 5C

我用如下命令create /testZNODE 创建了一个节点,却怎么也找不到我创建的这个节点,请问zookeeper的根节点在硬盘上哪里保存呢?

3个回答

首先在zookeeper 下创建一个用于测试的父节点, 下面的所有操作都在此节点下进行。 下面也会使用master 来指锁的所有者,follower 指要竞争锁的worker
create /locktest value

1,执行zkClient命令之后,进入客户端操作命令行,ls/ 是列出根节点的内容
2,zookeeper可以分为内存性节点和持久化节点,如果是持久化的节点,到zookeeper的dataDir目录下的version里去找

fuweihua123
fuweihua123 回复u010287873: 或者你在配置文件没有指定路径dataDir
一年多之前 回复
fuweihua123
fuweihua123 找不到就是有可能临时的
一年多之前 回复
u010287873
点滴记录,是前进的脚步 没有啊
一年多之前 回复

可以在配置文件中 制定data目录的

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
监控zookeeper根节点目录
package bigdata.zkdist;import java.util.ArrayList;import java.util.List;import org.apache.zookeeper.KeeperException;import org.apache.zookeeper.WatchedEvent;import org.apache.zookeeper.Watcher;import ...
找不到标识符,求指教。。。
#include rn#includernvoid main()rnrn int a,b,c,d;rn scanf("%d,%d,%d",&a,&b,&c);rn d=max(a,b,c);rn printf("max=%d",d);rn getch();rnrnrnint max(int x,int y,int z)rnrn int u;rn if(x>=y&&x>=z)rn u=x;rn else if(y>=x&&y>=z)rn u=y;rn elsern u=z;rn return(u);rnrn为什么生成时会失败,提示“max找不到标识符”???
求异常问题在哪里
这个异常问题在哪里啊?这个异常问题在哪里啊?这个异常问题在哪里啊?rnrnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:rnPropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'password' threw exception; nested exception is java.lang.Error: Unresolved compilation problem: rnrn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)rn at com.aryan.p2p.test.OOTest.testA(OOTest.java:15)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)rn at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)rn at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)rn at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)rn at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)rn at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)rn at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)rn at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)rn at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)rn at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)rn at org.junit.runners.ParentRunner.run(ParentRunner.java:236)rn at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)rnCaused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:rnPropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'password' threw exception; nested exception is java.lang.Error: Unresolved compilation problem: rnrn at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102)rn at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1393)rn ... 36 morernrn
求达人指教: 很简单的linux脚本,可是就是找不到问题在哪
for i in 01..45rndorn host=cnode`printf %02d $i`rn echo $hostrndonernrnsh text.sh后报错:rnrn'ext.sh: line 2: syntax error near unexpected token `dorn'ext.sh: line 2: `dornrn不知道咋回事。。。 求指教。。。。rn
zookeeper功能求指教大神进
zookeeper是怎么调用服务端的服务的?n比如:n之前有一台服务器提供http服务,浏览器请求服务器的方式为get请求url+参数n现在假设有三台服务器提供相同的http服务,使用zookeeper后,zookeeper是怎么把ger方式请求的url+参数传到服务器的?在项目zookeeper的代码里没找到和发送http请求相关的zookeeper代码。。
HBASE 找不到zookeeper节点
在Hbase的shell下,输入命令list,出现错误 ERROR: Can’t get master address from ZooKeeper; znode data == null
zookeeper 消费者找不到生产者
可能性分析:  1\  项目不是war包!!!!                       2\ 包名对不上就是接口和实现类的包名有出入找不到  
[ZooKeeper]ZooKeeper里的枚举和常量
znode的创建模式 ZooKeeper会话状态
找不到错在哪了,??
好像都已经关闭了呀???rnrnrn rnrn 登陆验证信息</tilte>rn</head>rnrn<%@include file="title.jsp"%>rn<%@ page Language="java" import="java.sql.*"%>rn<%@ page import="java.util.*"%>rn<% String uName=new string(request.getParameter("username").getBytes("ISO8859-1"));rn String pword=new string(riquest.getParameter("password").getBytes("ISO8859-1"));rn String sql="select * from sdz_user where username='"+uName+'" and password='"+pword+"'";rn try rn Class.forName("oracle,jdbc,driver,OracleDriver");rn rn catch(java.lang.ClassNotFoundExecption ex)rn rn System.err.println(ex.getMessage());rn rn tryrn Connection oraConn=DriverManager.getConnecton("jdbc:oracle:thin:@yh:1521:zykj","sdzxt","sdzxt");rn Statement state=new createStatement();rn ResultSet rs=state.executeQuery(sql);rn rn catch(SQLExecption ex)rn rn System.err.println(ex.getMessage());rn rn if(rs.next())rn rn rs.close();rn %>rn rn <%rn else %>rn rn <%%>rn rn rn rn rn提示错误:如下;rnParsing of JSP File '/logon.jsp' failed:rn--------------------------------------------------------------------------------rn /logon.jsp(15): scriptlet close brace '' unbalanced at line 15 which breaks scope '_base_service_scope_'rnprobably occurred due to an error in /logon.jsp line 15:rn rn--------------------------------------------------------------------------------rnThu Jun 24 11:39:42 CST 2004 rn rnrn
求解...找不到错在哪了
rn这程序我是完全按书上打下去的rn但是都出错了rn谁帮我一下rnrn//===============================rn//f0311.cpprn//若干个向量按长短排序rn//===============================rn#includern#includern#includern#includernusing namespace std;rn//-------------------------------rntypedef vector> Mat;rnMat input();rnvoid mySort(Mat& a);rnvoid print(const Mat& a);rn//--------------------------------rnint main()rnrn Mat a= input();rn mySort(a);rn print(a);rnrn//---------------------------------rnMat input()rnrn ifstream in("aaa.txt");rn Mat a;rn for(string s; getline(in, s); )rn rn vector b;rn istringstream sin(s);rn for(int ia; sin>>ia; )rn b.push_back(ia)rn a.push_back(b);rn rn return a;rnrn//----------------------------------rnvoid mySort(Mat& a)rnrn for(int pass=1;pass' before ';'rnC:\Documents and Settings\Administrator\桌面\f0311.cpp(11) : warning C4091: 'typedef ' : ignored on left of 'class std::vector' when no variable is declaredrnC:\Documents and Settings\Administrator\桌面\f0311.cpp(12) : error C2146: syntax error : missing ';' before identifier 'input'rnC:\Documents and Settings\Administrator\桌面\f0311.cpp(12) : error C2501: 'Mat' : missing storage-class or type specifiersrnC:\Documents and Settings\Administrator\桌面\f0311.cpp(12) : fatal error C1004: unexpected end of file foundrnError executing cl.exe.
找不到程序在哪
我在命令行中执行 ping netstat 或者是masm 等程序, 想看看它们的目录, 找了半天没找到, 各位有什么好的方法吗?rn简单的小工具就可以
Ubuntu安装的软件找不到在哪
本人linux菜鸟,现在需要一个通信仿真软件ION,在ubuntu里安装之后却找不到软件在哪rn安装步骤如下:rn进入安装包文件夹下,rn./configurernmakernmake testrnsudo make installrn整个过程下来没有什么问题,但是就是找不到软件在哪,rndpkg -l目录里也没有,教程里说默认安装在/opt文件夹里,但是里面是空的rn求各位大佬帮帮忙,已经卡在这里很久了[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/001/face/5.gif][/img]
网卡找不到了?在哪?
新做的win2k,装了iaa,inf,显卡声卡和DX8.1,装完以后发现插在板子上的8139网卡没找到~~~,是不是少干了什么活才找不到的?(我的是双系统,98下就找到了网络适配器)
错在哪,请指教!!
unit Unit1;rnrninterfacernrnusesrn Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,rn Dialogs,stdctrls;rnrntypern TForm1 = class(TForm)rn procedure FormShow(Sender: TObject);rn privatern Private declarations rn publicrn Public declarations rn end;rnrnvarrn Form1: TForm1;rn procedure myclick(sender:Tobject);rnimplementationrn procedure myclick(sender:Tobject);rn beginrn showmessage('You click the Button');rn end;rn$R *.dfmrnrnprocedure TForm1.FormShow(Sender: TObject);rnvarrn a:TButton;rnbeginrn a:=TButton.create(self);rn a.parent:=self;rn a.Left:=40;rn a.Top:=80;rn a.Caption:='OK';rn a.OnClick:=myclick;rnend;rnrnend.rn
请指教毛病在哪??
本人编写一个程序,让用户在Edit Box中输入RGB的R、G、 B的值,然后点击命令按钮“显示”,就在一个Static控件中显示输入的相应颜色,结果Static控件没反应,不知下面的毛病再哪里?弟不才,请高手指教。谢谢!!!rn //显示颜色!!!rn CWnd *pWnd = GetDlgItem(IDC_STATIC_RGB);rn CDC * pMyDC=pWnd->GetDC();rnrn CBrush brush;rn brush.CreateSolidBrush(RGB(r,g,b));rn CRect rect;rn pWnd->GetWindowRect(&rect);rn pMyDC->FillRect(&rect,&brush);rn pWnd->ReleaseDC(pMyDC);
错误在哪??请指教
每次从输入流中读取一个数据 保存在ID 这个整型变量中 为什么执行有错误 编译能通过rnbyte a[]=new byte[10];rn rn tryrn System.in.read(a);rn rn catch(Exception e)rn rn id=Integer.parseInt(new String(a));
求指教求指教!
我自己写了个jsp,登入用的,一点登入就出现The server encountered an internal error () that prevented it from fulfilling this request.这是什么问题呀?真心求解压?
找不到microsoft office interop excel,求指教!!
想添加microsoft office interop excel引用,在。net和com中都找不到。请问是什么问题?是装的office的问题还是其他?在线求解答。
socket 菜鸟求指教~ 找不到主函数?
写一个C/S的socket app,实现通信和一些自定义的基本命令, 以下代码可以正常编译,但是无论是server还是client,命令行下一运行就出错,显示[img=http://img.my.csdn.net/uploads/201211/15/1352929416_5102.png][/img]rnrn[code=java]package ClientServer;rn//clientrnimport java.io.*;rnimport java.net.*;rnrnpublic class myClient rnrn public static void main(String[] args) throws IOException rn String servername = args[0];rn int port = Integer.parseInt(args[1]);rn rn Socket clientsocket = null;rn PrintStream out = null;rn BufferedReader in = null;rn boolean connected = false;rn boolean isEcho = false;rn rn try rn clientsocket = new Socket(servername, port); rn connected = true;rn out = new PrintStream(clientsocket.getOutputStream());rn in = new BufferedReader(new InputStreamReader(clientsocket.getInputStream()));rn catch (IOException e) rn System.err.println("Error:Cannot connect to server!");rn System.exit(1);rn rn rn BufferedReader stdIn = new BufferedReader (new InputStreamReader(System.in));rn String userInput;rn rn //out.print("client");rn while (connected) rn System.out.println("Session has been established.");rn System.out.print("operation>");rn userInput = stdIn.readLine(); rn if (userInput == "whoAMi") rn out.println(userInput);rn System.out.println(in.readLine());rn else if (userInput == "bye") rn out.println(userInput);rn System.out.println(in.readLine());rn connected = false;rn else if (userInput == "startEcho") rn isEcho = true;rn out.println(userInput);rn System.out.println(in.readLine());rn rn String echoInput;rn while (isEcho) rn System.out.print("echo>");rn echoInput = stdIn.readLine();rn if (echoInput == "stopEcho") rn isEcho = false;rn rn out.println(echoInput);rn System.out.println(in.readLine());rn rn rn rn System.out.println("Session is terminated.");rn rn out.close();rn in.close();rn stdIn.close();rn clientsocket.close();rn rnrnrnrnrnrnpackage ClientServer;rn//serverrnimport java.io.*;rnimport java.net.*;rnrnpublic class myServerrn ServerSocket serversocket;rn String inputLine, outputLine;rn String message;rnrn public myServer(int portNum)rn rn void run()rn rn tryrn FileWriter fstream = new FileWriter("Log.txt", true);rn PrintWriter log = new PrintWriter(fstream);rn rn System.out.println("Waiting for client on port " + serversocket.getLocalPort());rn Socket clientsocket = serversocket.accept();rn System.out.println("Connected to client on " + clientsocket.getRemoteSocketAddress());rn log.println("\r\n************SocketLog**************");rn log.println("Connected to client on " + clientsocket.getRemoteSocketAddress());rn rn PrintStream out = new PrintStream(clientsocket.getOutputStream());rn BufferedReader in = new BufferedReader(new InputStreamReader(clientsocket.getInputStream()));rn rn while ((inputLine = in.readLine()) != null) rn rn if (inputLine == "whoAMi") rn //outputLine = "server: " + serversocket.getLocalSocketAddress();rn outputLine = "server: " + java.net.InetAddress.getLocalHost().getHostAddress();rn out.println(outputLine);rn log.println("\nOperation from client " + clientsocket.getRemoteSocketAddress() +": "+ inputLine);rn else if (inputLine == "startEcho") rn outputLine = "listening";rn out.println(outputLine);rn log.println("\nOperation from client " + clientsocket.getRemoteSocketAddress() +": "+ inputLine);rn log.println("\nNow in Echo mode.\n");rn rn while ((message = in.readLine()) != null) rn if (message == "stopEcho") rn log.println("Operation from client " + clientsocket.getRemoteSocketAddress() +": "+ message);rn log.println("Now out of Echo mode.");rn break;rn rn outputLine = "server: " + message;rn out.println(outputLine);rn log.println("Echo from client " + clientsocket.getRemoteSocketAddress() +": "+ message);rn rn out.println("stopped");rn else if (inputLine == "bye") rn System.out.println("Connection to client " + clientsocket.getRemoteSocketAddress() + " terminated.");rn log.println("Connection to client " + clientsocket.getRemoteSocketAddress() + " terminated.");rn out.println("bye");rn break;rn rn rn out.close();rn in.close();rn clientsocket.close();rn log.close();rn fstream.close();rn rn catch (IOException e) rn System.exit(1);rn rn rn rn public static void main(String[] args)rn rn int portNum = Integer.parseInt(args[0]);rn myServer server = new myServer(portNum);rn while(true)rn server.run();rn rn rnrn[/code]rnrn不知道是什么错误?找不到主函数?新手求详细指导~~谢各位大神啊~~
运行时报错:“找不到Int32 System.String.Compare。。。。。” 求指教
运行时报错:“找不到Int32 System.String.Compare(System.String,System.String,System.Globalization.CultureInfo,System.Globalization.CompareOptions)”。rn引用中添加了"System"。rn但其实这个函数是micorlib.dll中的system的,而引用中无法添加这个文件,此项目系统自动引用。rn查看此文件,确实没有这个Compare函数。但是另一台机子中也没有这个函数,但能正常运行。。。。。。rn很奇怪,原来没问题,突然产生了这个问题。rnrn求指教
C#...closing事件在哪改?找不到。。。
RT
[ZooKeeper]ZooKeeper里提供认证功能的插件
-
锁在哪,手动找,找不到
同上
vc++6.0找不到类视图在哪?
vc++6.0菜单空白区域——右键——工作空间。 即可显示
连接数据库出错,?找不到错在哪.
unit de1;rnrninterfacernrnusesrn Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,rn Dialogs, Grids, DBGrids, StdCtrls, DB, ADODB;rnrntypern TForm1 = class(TForm)rn ds1: TDataSource;rn Button1: TButton;rn qry1: TADOQuery;rn con1: TADOConnection;rn procedure Button1Click(Sender: TObject);rn privatern Private declarations rn publicrn Public declarations rn end;rnrnvarrn Form1: TForm1;rnrnimplementationrnrn$R *.dfmrnrnprocedure TForm1.Button1Click(Sender: TObject);rnbeginrn//tbl1.Open;rnqry1.sql.Clear;rnqry1.SQL.Add('select * from user');rnqry1.Open;rnend;rnrnend.rnrnrn[错误] Write error on 'C:\Project1.exe'rn[错误] RLINK32: Error writing file "C:\Project1.exe"rnrn
strstr函数,找不到问题在哪?
#include rn#include rn#include rn#include rnint qukong(char* str, char*sub_str)rnrn char* begin = str;rn char* end = NULL;rn end = begin + strlen(str) - 1;rn char* temp = sub_str;rn if (str == NULL || sub_str == NULL) rn fprintf(stderr, "str==NULL||sub_str==NULL");rn return -1;rn rnrn // while (*begin = ' '&&*begin != '\0')begin++; rn while (isspace(*begin) && *begin != '\0')begin++;rnrn // while (*end = ' '&&end > begin)end--;rn while (isspace(*end) && end > begin)end--;rn int len = end - begin + 1;rn for (int i = 0; i < len; i++)rn rn *(temp + i) = *(begin + i);rn rn *(temp + len + 1) = '\0';rn return 0;rnrn/*rn键值对(“key=value”)字符串,在开发中经常使用rn要求1:清自己定义一个接口,实现根据key获取rn要求2:编写测试用例。rn要求3:键值对中间可能有n多空格,请去除空格rn注意:键值堆字符串格式可能如下:rn“key1=value1”rn"key2= value2"rn"key3 =value3 "rn"key4 =value4"rn"key5 = "rn"key6 ="rn*/rn/*rn此函数实现以下:rn“key1=value1”rn"key2= value2 "rn"key3 =value3 "rn"key4 =value4"rn"key5 = "rn"key6 ="rnkeyvaluebuf:in 输入,得到原字符串rnkeybuf :in输出,要找到的keyrnvaluebuf :out输出,得到valuernvaluelen :out输出,得到value长度rnint getkeybyvalue(char* keyvaluebuf,char*keybuf,char*valuebuf,int* valuelen)rn*/rnint getkeybyvalue(/*in*/char* keyvaluebuf,/*in*/ char*keybuf,/*out*/ char*valuebuf, int* valuelen)rnrn char* p= keyvaluebuf; //复制了三个的首地址rn char* key_p = keybuf;rn char* value_p = valuebuf;rnrn //1.要找到keyrn p = strstr(p, key_p);rn if (p == NULL)rn rn printf("meiyou zhao dao key\n");rn return -1;rn rn rn //2.要找到=rn p = p+strlen(key_p);rn printf("get2\n"); //运行时出现了get2rn p = strstr(p,'='); //问题应该就出现在这里,为什么会导致崩溃?rn if (p == NULL) rn printf("meiyou zhao dao =\n");rn return -1;rn rn printf("get3\n"); //没有出现get3rn //3.要找到valuern p++;rn int ent=qukong(p, value_p);rn if (ent < 0)printf("xunzhao shibai!\n");rn rn int len = 0;rn len = strlen(value_p);rn *valuelen = len;rnrn return 0;rnrnrnint main()rnrn char* str = " key2= value2 ";rn char* key = "key2";rn char* valuebuf[120] = 0 ;rn int len = 0;rn int retn = 0;rn retn = getkeybyvalue(str, "key2", valuebuf, &len);rn if (retn < 0)rn rn printf("shibai!");rn return -1;rn rn printf("valuebuf:%s", valuebuf);rnrn return 0;rnrn就是出现在我注释的地方,获取=所在地址。rn //2.要找到=rn p = p+strlen(key_p);rn printf("get2\n"); //运行时出现了get2rn p = strstr(p,'='); //问题应该就出现在这里,为什么会导致崩溃?rn if (p == NULL) rn printf("meiyou zhao dao =\n");rn return -1;rn rn printf("get3\n"); //没有出现get3rn问题出在哪里呢??
调制解调器在哪呢?找不到啊?
突然想到怎么没有看到调制解调器啊,办公室就一个交换机。
VC2008里找不到“微调按钮控件”,谁能告诉我在哪?
我是按照Ivor Horton老头的书(2005版的)编写的,但是找不到书中写的“微调按钮控件”,然后看他2008英文版的书,他又改成“List control”,难道是vc2008里没有“微调按钮控件”?
求教Java编程思想里面的一题,怎么也找不到错误在哪!
[b]这是书上第11章持有对象里面的练习31题rn(3)修改RandomShapeGenerator.java,使其成为一个Iterable。rn这是LZ写的代码:[/b]rn[code=java]public class RandomShapeIterable implements Iterator rn private Random rand = new Random(27);rn private final int generateShapeNum;rn public RandomShapeIterable( int generateShapeNum ) rn this.generateShapeNum = generateShapeNum;rn rn rn public Iterator iterator() rn return new Iterator() rn private int num = 0;rn public boolean hasNext() rn return num < generateShapeNum;rn rn public Shape next() rn num++;rn switch(rand.nextInt(3)) rn default:rn case 0: return new Circle();rn case 1: return new Square();rn case 2: return new Triangle();rn rn rn public void remove() rn throw new UnsupportedOperationException();rn rn ;rn rn public static void main(String[] args) rn for (Shape s : new RandomShapeIterable(10)) rn s.draw();rn s.erase();rn rn rnrnrn[/code]rnrn[b]报错如下:[/b]rn[img=http://img.my.csdn.net/uploads/201301/08/1357649527_4836.png][/img]rnrn[b]在下面是答案上的代码[/b]rn[code=java]class RandomShapeGenerator implements Iterable rn private Random rand = new Random(47);rn private final int quantity;rnrn RandomShapeGenerator(int quantity) rn this.quantity = quantity;rn rnrn public Iterator iterator() rn return new Iterator() rn private int count;rnrn public boolean hasNext() rn return count < quantity;rn rnrn public Shape next() rn ++count;rn return nextShape();rn rnrn public void remove() // Not implementedrn throw new UnsupportedOperationException();rn rn ;rn rnrn private Shape nextShape() rn switch (rand.nextInt(3)) rn default:rn case 0:rn return new Circle();rn case 1:rn return new Square();rn case 2:rn return new Triangle();rn rn rnrnrnpublic class E31_IterableRandomShapeGenerator rn public static void main(String[] args) rn RandomShapeGenerator rsg = new RandomShapeGenerator(10);rn for (Shape shape : rsg)rn System.out.println(shape.getClass().getSimpleName());rn rnrn[/code]rnrn[b][color=#FF0000]好吧,撸主不明白的地方有两处:rn一、为什么实现Iterable接口的类不用在类中实现hasNext()、next()、remove()的定义,rn然而在内部类里实现后却能够运行?rn二、撸主检查了一遍又一遍实在是找不到自己写的代码到底哪里出了错,我感觉明明就跟答案里的一样啊?rn跪求大神指点啊!!!rn[/color][/b]
请高手指教错误在哪?????
rnrn为什么点击‘hw 3.gif' 不调用‘wh()’?rn为什么点击‘hw 2.gif' 不调用‘hwwh()’?rn我想了好几天都没想通,请高手指教!!!!rnrnrnrn rnrnrnrnrnrn
问题出在哪???请指教
程序如下:rnimport java.awt.*;rnimport java.applet.*;rnimport javax.swing.*;rnrnpublic class echorn public static void main(String args[])rn JButton b1;rn JFrame f =new JFrame("sooeooe...");rn f.resize(400,67);rn f.add(new JLabel("applet java!",JLabel.CENTER));rn b1 = new JButton("you");rn f.add(b1);rn f.show();rn rnrnrn运行时提示一下错误:rnException in thread "main" java.lang.Error: Do not use javax.swing.JFrame.add()rnuse javax.swing.JFrame.getContentPane().add() insteadrn at javax.swing.JFrame.createRootPaneException(JFrame.java:458)rn at javax.swing.JFrame.addImpl(JFrame.java:484)rn at java.awt.Container.add(Container.java:307)rn at echo.main(echo.java:48)rnrnrn请问问题 出在哪?rnrnrn
错误在哪,请大虾指教????
我写了一个javabean,用jsp调用,错误在那呢?rnDboperation.javarn//数据库操作Beanrnpackage Dbbean;rnimport java.sql.*;rnimport java.util.*;rnrnpublic class Dboperationrnrn private Connection conn=null;rn private Statement stmt=null;rn private ResultSet rs =null;rn public void BuildConn(String strConn,String strUid,String strPwd)rn rn tryrn rn Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");rn conn=DriverManager.getConnection(strConn,strUid,strPwd);rn stmt=conn.createStatement();rn rn catch(Exception e)rn rn System.out.println(e.toString());rn rn rn public void execUpdate(String sql)rn rn tryrn rn stmt.executeUpdate(sql);rn rn catch(Exception e)rn rn System.out.println(e.toString());rn rn rn public ResultSet ReturnRS(String sql)rn rn tryrn rn rs=stmt.executeQuery(sql);rn rn catch(Exception e)rn rn System.out.println(e.toString()); rn rn return rs;rn rn rn rndbop.jsprn<%@ page contentType="text/html;charset=gb2312" import="java.sql.*"%>rnrn<%rnResultSet rs=null;rntryrnrn db.BuildConn("jdbc:odbc:conndb","eipoa","123456");rnrncatch(Exception ex)rnrn System.out.println(ex.toString());rnrn%>rn注释db.BuildConn("jdbc:odbc:conndb","eipoa","123456");就不报错为什么
事务处理,问题在哪?请指教!
begin Transactionrnrnfor i= 0 to table1.recordcountrn select table1rn update table1rn insert table1rnnextrnrncommitrnrn大体的流程就是上面的那个样子,当第二次循环时(即更新第二条记录),操作不能继续,直到超时,rn这是什么?rnrnrn
找不到的错误,请指教!
class TDate1rnrn public:rn TDate1(int y,int m,int d)rn ~TDate1();rn void Print();rn private:rn int year,month,day;rn;rnTDate1::TDate1(int y,int m,int d)rnrn year=y;month=m;day=d;rn cout<<"Constructor Called. \n";rnrnTDate1::~TDate1()rnrn cout<<"destructor called. \n";rnrnvoid TDate1::Print()rncout<
_DEBUG在哪里去掉
我在代码里写了#ifdef _DEBUG的部分,rn在工程设置的conditional defines里去掉了_DEBUG,rn但是编译后,还是执行#ifdef _DEBUG的部分rn应该在哪里去掉啊?rn
在哪里找到strsafe.h
下载的一个源程序,用到strsafe.h,但是我的VC++6.0没有这个库文件,我该怎么办?
QuickRpt.pas 在哪里去找?
在编程时,找不到其对应的组件rn在线等!谢谢
CB6 的数据字典 在哪 里?
SQL Explore 中 有Dictionary,但是 点击后却没有内容 ?菜单Import from Database也是灰色的 。rn专业版的 cbc 6.怎么 找出来 ?谢谢
jQuery里$(this)和this的区别在哪?
jQuery里$(this)和this的区别在哪?       如果你要使用html元素本身的属性或方法就需要使用this,如果你要使用jQuery包装后的方法或属性就要$(this),一般则有如下的关系. $(this)[0] == this; 上文的代码是要使用this的地方是要调用表单form的有reset方法,而这一方法jQuery没有包装支持,所以才有this.res...
错在哪 里??
#include rnrnlong sign(int bit);rnrnrn/* 打印各类型取值范围 版本2 */rnrnmain()rnrn int lo; /* 定义: lo = long */rnrn lo = 32; /* 各类型的位数 */rn rnrnrn rn printf ("signed long的取值范围 %ld---%ld\n",sign(lo),sign(lo)-1);rnrn return 0;rnrn/* sign 函数:计算2的n-1次方,并返回其数值 */rnlong sign(int bit)rnrn int i, u;rn u = 2;rnrn for (i = 2; i <= bit - 1; ++i)rn u = u * 2;rn return u;rnrn为什么输出为 0 -- -1。错在哪 里,请各位帮忙修改一下!!rn
相关热词 c# stream 复制 android c# c#监测窗口句柄 c# md5 引用 c# 判断tabtip 自己写个浏览器程序c# c# 字符串变成整数数组 c#语言编程写出一个方法 c# 转盘抽奖 c#选中treeview