summaryrefslogtreecommitdiffstats
path: root/tutorial/tutorial.html
diff options
context:
space:
mode:
Diffstat (limited to 'tutorial/tutorial.html')
-rw-r--r--tutorial/tutorial.html4
1 files changed, 3 insertions, 1 deletions
diff --git a/tutorial/tutorial.html b/tutorial/tutorial.html
index d62743d0..dea83069 100644
--- a/tutorial/tutorial.html
+++ b/tutorial/tutorial.html
@@ -1044,7 +1044,9 @@ adds a new field <code>hiddenValue</code> to <code>java.lang.String</code>:
<ul><pre>ClassPool pool = ClassPool.getDefault();
CtClass cc = pool.get("java.lang.String");
-cc.addField(new CtField(CtClass.intType, "hiddenValue", cc));
+CtField f = new CtField(CtClass.intType, "hiddenValue", cc);
+f.setModifiers(Modifier.PUBLIC);
+cc.addField(f);
cc.writeFile(".");</pre></ul>
<p>This program produces a file <code>"./java/lang/String.class"</code>.