⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tij304.htm

📁 这也是我们java老师给我们的thinking in java的一些资料
💻 HTM
📖 第 1 页 / 共 5 页
字号:

<BLOCKQUOTE><FONT SIZE = "+1"><PRE>returnType methodName( <font color=#009900>/* Argument list */</font> ) {
  <font color=#009900>/* Method body */</font>
}</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>The return type is the type of the value that pops out of the method after you call it. The argument list gives the types and names for the information you want to pass into the method. The method name and argument list together uniquely identify the method. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_410" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Methods in Java can be created only as part of a class. A method can be called only for an object,<sup><a name="fnB11" href="#fn11">[11]</a></sup> and that object must be able to perform that method call. If you try to call the wrong method for an object, you&#146;ll get an error message at compile time. You call a method for an object by naming the object followed by a period (dot), followed by the name of the method and its argument list, like this: <br></p>

<BLOCKQUOTE><FONT SIZE = "+1"><PRE>objectName.methodName(arg1, arg2, arg3);</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>For example, suppose you have a method <b>f(&#160;)</b> that takes no arguments and returns a value of type <b>int</b>. Then, if you have an object called <b>a</b> for which <b>f(&#160;)</b> can be called, you can say this:<br></p>

<BLOCKQUOTE><FONT SIZE = "+1"><PRE><font color=#0000ff>int</font> x = a.f();</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>The type of the return value must be compatible with the type of <b>x</b>. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_411" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>This act of calling a method is commonly referred to as <i>sending a message to an object</i>. In the preceding example, the message is <b>f(&#160;)</b> and the object is <b>a</b>. Object-oriented programming is often summarized as simply &#147;sending messages to objects.&#148; <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_412" title="Send BackTalk Comment">Feedback</a></font><br></p>
<h3>
<a name="_Toc375545228"></a><a name="_Toc24775554"></a><a name="Heading1457"></a>The
argument list</h3>
<p>The method argument list specifies what information you pass into the method. As you might guess, this information&#151;like everything else in Java&#151;takes the form of objects. So, what you must specify in the argument list are the types of the objects to pass in and the name to use for each one. As in any situation in Java where you seem to be handing objects around, you are actually passing references.<sup><a name="fnB12" href="#fn12">[12]</a></sup> The type of the reference must be correct, however. If the argument is supposed to be a <b>String</b>, you must pass in a <b>String</b> or the compiler will give an error. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_413" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Consider a method that takes a <b>String</b> as its argument. Here is the definition, which must be placed within a class definition for it to be compiled:<br></p>

<BLOCKQUOTE><FONT SIZE = "+1"><PRE><font color=#0000ff>int</font> storage(String s) {
  <font color=#0000ff>return</font> s.length() * 2;
}</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>This method tells you how many bytes are required to hold the information in a particular <b>String. </b>(Each <b>char </b>in a <b>String </b>is 16 bits, or two bytes, long, to support Unicode characters.) The argument is of type <b>String</b> and is called <b>s</b>. Once <b>s</b> is passed into the method, you can treat it just like any other object. (You can send messages to it.) Here, the <b>length(&#160;)</b> method is called, which is one of the methods for <b>String</b>s; it returns the number of characters in a string. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_414" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>You can also see the use of the <b>return</b> keyword, which does two things. First, it means &#147;leave the method, I&#146;m done.&#148; Second, if the method produces a value, that value is placed right after the <b>return</b> statement. In this case, the return value is produced by evaluating the expression <b>s.length(&#160;) * 2</b>. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_415" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>You can return any type you want, but if you don&#146;t want to return anything at all, you do so by indicating that the method returns <b>void</b>. Here are some examples:<br></p>

<BLOCKQUOTE><FONT SIZE = "+1"><PRE><font color=#0000ff>boolean</font> flag() { <font color=#0000ff>return</font> <font color=#0000ff>true</font>; }
<font color=#0000ff>float</font> naturalLogBase() { <font color=#0000ff>return</font> 2.718f; }
<font color=#0000ff>void</font> nothing() { <font color=#0000ff>return</font>; }
<font color=#0000ff>void</font> nothing2() {}</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>When the return type is <b>void</b>, then the <b>return</b> keyword is used only to exit the method, and is therefore unnecessary when you reach the end of the method. You can return from a method at any point, but if you&#146;ve given a non-<b>void </b>return type, then the compiler will force you (with error messages) to return the appropriate type of value regardless of where you return. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_416" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>At this point, it can look like a program is just a bunch of objects with methods that take other objects as arguments and send messages to those other objects. That is indeed much of what goes on, but in the following chapter you&#146;ll learn how to do the detailed low-level work by making decisions within a method. For this chapter, sending messages will suffice. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_417" title="Send BackTalk Comment">Feedback</a></font><br></p>
<h2>
<a name="_Toc375545229"></a><a name="_Toc24775555"></a><a name="Heading1475"></a>Building
a Java program</h2>
<p>There are several other issues you must understand before seeing your first Java program. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_418" title="Send BackTalk Comment">Feedback</a></font><br></p>
<h3>
<a name="_Toc375545230"></a><a name="_Toc24775556"></a><a name="Heading1477"></a>Name
visibility</h3>
<p>A problem in any programming language is the control of names. If you use a name in one module of the program, and another programmer uses the same name in another module, how do you distinguish one name from another and prevent the two names from &#147;clashing?&#148; In C this is a particular problem because a program is often an unmanageable sea of names. C++ classes (on which Java classes are based) nest functions within classes so they cannot clash with function names nested within other classes. However, C++ still allows global data and global functions, so clashing is still possible. To solve this problem, C++ introduced <i>namespaces</i> using additional keywords. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_419" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Java was able to avoid all of this by taking a fresh approach. To produce an unambiguous name for a library, the specifier used is not unlike an Internet domain name. In fact, the Java creators want you to use your Internet domain name in reverse since those are guaranteed to be unique. Since my domain name is <b>BruceEckel.com</b>, my utility library of foibles would be named <b>com.bruceeckel.utility.foibles</b>. After your reversed domain name, the dots are intended to represent subdirectories. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_420" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>In Java 1.0 and Java 1.1 the domain extensions <b>com</b>, <b>edu</b>, <b>org</b>, <b>net</b>, etc., were capitalized by convention, so the library would appear: <a name="Index121"></a><a name="Index122"></a><b>COM.bruceeckel.utility.foibles</b>. Partway through the development of Java 2, however, it was discovered that this caused problems, so now the entire package name is lowercase. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_421" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>This mechanism means that all of your files automatically live in their own namespaces, and each class within a file must have a unique identifier. So you do not need to learn special language features to solve this problem&#151;the language takes care of it for you. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_422" title="Send BackTalk Comment">Feedback</a></font><br></p>
<h3>
<a name="_Toc375545231"></a><a name="_Toc24775557"></a><a name="Heading1482"></a>Using
other components</h3>
<p>Whenever you want to use a predefined class in your program, the compiler must know how to locate it. Of course, the class might already exist in the same source code file that it&#146;s being called from. In that case, you simply use the class&#151;even if the class doesn&#146;t get defined until later in the file (Java eliminates the &#147;forward referencing&#148; problem, so you don&#146;t need to think about it). <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_423" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>What about a class that exists in some other file? You might think that the compiler should be smart enough to simply go and find it, but there is a problem. Imagine that you want to use a class with a particular name, but more than one definition for that class exists (presumably these are different definitions). Or worse, imagine that you&#146;re writing a program, and as you&#146;re building it you add a new class to your library that conflicts with the name of an existing class. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_424" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>To solve this problem, you must eliminate all potential ambiguities. This is accomplished by telling the Java compiler exactly what classes you want by using the <b>import</b> keyword. <b>import </b>tells the compiler to bring in a package, which is a library of classes. (In other languages, a library could consist of functions and data as well as classes, but remember that all code in Java must be written inside a class.) <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_425" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Most of the time you&#146;ll be using components from the standard Java libraries that come with your compiler. With these, you don&#146;t need to worry about long, reversed domain names; you just say, for example:<br></p>

<BLOCKQUOTE><FONT SIZE = "+1"><PRE><font color=#0000ff>import</font> java.util.ArrayList;</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>to tell the compiler that you want to use Java&#146;s <b>ArrayList</b> class. However, <b>util</b> contains a number of classes and you might want to use several of them without declaring them all explicitly. This is easily accomplished by using &#145;<b>*</b>&#146; to indicate a wild card:<br></p>

<BLOCKQUOTE><FONT SIZE = "+1"><PRE><font color=#0000ff>import</font> java.util.*;</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>It is more common to import a collection of classes in this manner than to import classes individually. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_426" title="Send BackTalk Comment">Feedback</a></font><br></p>
<h3>
<a name="_Toc375545232"></a><a name="_Toc24775558"></a><a name="Heading1493"></a>The
<b>static</b> keyword</h3>
<p>Ordinarily, when you create a class you are describing how objects of that class look and how they will behave. You don&#146;t actually get anything until you create an object of that class with <b>new</b>, and at that point data storage is created and methods become available. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_427" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>But there are two situations in which this approach is not sufficient. One is if you want to have only one piece of storage for a particular piece of data, regardless of how many objects are created, or even if no objects are created. The other is if you need a method that isn&#146;t associated with any particular object of this class. That is, you need a method that you can call even if no objects are created. You can achieve both of these effects with the <b>static</b> keyword. When you say something is <b>static</b>, it means that data or method is not tied to any particular object instance of that class. So even if you&#146;ve never created an object of that class you can call a <b>static</b> method or access a piece of <b>static</b> data. With ordinary, non-<b>static</b> data and methods, you must create an object and use that object to access the data or method, since non-<b>static</b> data and methods must know the particular object they are working with. Of course, since <b>static</b> methods don&#146;t need any objects to be created before they are used, they cannot <i>directly </i>access non-<b>static</b> members or methods by simply calling those other members without referring to a named object (since non-<b>static</b> members and methods must be tied to a particular object). <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_428" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Some object-oriented languages use the terms <i>class data</i> and <i>class methods</i>, meaning that the data and methods exist only for the class as a whole, and not for any particular objects of the class. Sometimes the Java literature uses these terms too. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_429" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>To make a field or method <b>static</b>, you simply place the keyword before the definition. For example, the following produces a <b>static</b> field and initializes it: <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_430" title="Send BackTalk Comment">Feedback</a></font><br></p>

<BLOCKQUOTE><FONT SIZE = "+1"><PRE><font color=#0000ff>class</font> StaticTest {
  <font color=#0000ff>static</font> <font color=#0000ff>int</font> i = 47;
}</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>Now even if you make two <b>StaticTest</b> objects, there will still be only one piece of storage for <b>StaticTest.i.</b> Both objects will share the same <b>i</b>.<b> </b>Consider: <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_431" title="Send BackTalk Comment">Feedback</a></font><br></p>

<BLOCKQUOTE><FONT SIZE = "+1"><PRE>StaticTest st1 = <font color=#0000ff>new</font> StaticTest();
StaticTest st2 = <font color=#0000ff>new</font> StaticTest();</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>At this point, both <b>st1.i</b> and <b>st2.i</b> have the same value of 47 since they refer to the same piece of memory. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_432" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>There are two ways to refer to a <b>static</b> variable. As the preceeding example indicates, you can name it via an object, by saying, for example, <b>st2.i</b>. You can also refer to it directly through its class name, something you cannot do with a non-static member. (This is the preferred way to refer to a <b>static</b> variable since it emphasizes that variable&#146;s <b>static</b> nature.) <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_433" title="Send BackTalk Comment">Feedback</a></font><br></p>

<BLOCKQUOTE><FONT SIZE = "+1"><PRE>StaticTest.i++;</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>The <b>++</b> operator increments the variable. At this point, both <b>st1.i</b> and <b>st2.i</b> will have the value 48. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_434" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Similar logic applies to static methods. You can refer to a static method either through an object as you can with any method, or with the special additional syntax <b>ClassName.method(&#160;)</b>. You define a static method in a similar way: <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_435" title="Send BackTalk Comment">Feedback</a></font><br></p>

<BLOCKQUOTE><FONT SIZE = "+1"><PRE><font color=#0000ff>class</font> StaticFun {
  <font color=#0000ff>static</font> <font color=#0000ff>void</font> incr() { StaticTest.i++; }
}</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>You can see that the <b>StaticFun</b> method <b>incr(&#160;)</b> increments the <b>static</b> data <b>i</b> using the <b>++ </b>operator. You can call <b>incr(&#160;)</b> in the typical way, through an object: <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_436" title="Send BackTalk Comment">Feedback</a></font><br></p>

<BLOCKQUOTE><FONT SIZE = "+1"><PRE>StaticFun sf = <font color=#0000ff>new</font> StaticFun();
sf.incr();</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>Or, because <b>incr(&#160;) </b>is a static method, you can call it directly through its class: <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_437" title="Send BackTalk Comment">Feedback</a></font><br></p>

<BLOCKQUOTE><FONT SIZE = "+1"><PRE>StaticFun.incr();</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>Although <b>static</b>, when applied to a field, definitely changes the way the data is created (one for each class versus the non-<b>static </b>one for each object), when applied to a method it&#146;s not so dramatic. An important use of <b>static</b> for methods is to allow you to call that method without creating an object. This is essential, as we will see, in defining the <b>main(&#160;)</b> method that is the entry point for running an application. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_438" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>Like any method, a <b>static</b> method can create or use named objects of its type, so a <b>static</b> method is often used as a &#147;shepherd&#148; for a flock of instances of its own type. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_439" title="Send BackTalk Comment">Feedback</a></font><br></p>
<h2>
<a name="_Toc375545233"></a><a name="_Toc24775559"></a><a name="Heading1525"></a>Your
first Java program</h2>
<p>Finally, here&#146;s the first complete program. It starts by printing a string, and then the date, using the <b>Date </b>class from the Java standard library. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_440" title="Send BackTalk Comment">Feedback</a></font><br></p>

<BLOCKQUOTE><FONT SIZE = "+1"><PRE><font color=#009900>// HelloDate.java</font>
<font color=#0000ff>import</font> java.util.*;

<font color=#0000ff>public</font> <font color=#0000ff>class</font> HelloDate {
  <font color=#0000ff>public</font> <font color=#0000ff>static</font> <font color=#0000ff>void</font> main(String[] args) {
    System.out.println(<font color=#004488>"Hello, it's: "</font>);
    System.out.println(<font color=#0000ff>new</font> Date());
  }
}</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>At the beginning of each program file, you must place the <b>import</b> statement to bring in any extra classes you&#146;ll need for the code in that file. Note that I say &#147;extra.&#148; That&#146;s because there&#146;s a certain library of classes that are automatically brought into every Java file: <b>java.lang</b>. Start up your Web browser and look at the documentation from Sun. (If you haven&#146;t downloaded the JDK documentation from <i>java.sun.com</i>, do so now<sup><a name="fnB13" href="#fn13">[13]</a></sup>). If you look at the list of the packages, you&#146;ll see all the different class libraries that come with Java. Select <b>java.lang</b>. This will bring up a list of all the classes that are part of that library. Since <b>java.lang</b> is implicitly included in every Java code file, these classes are automatically available. There&#146;s no <b>Date</b> class listed in <b>java.lang</b>, which means you must import another library to use that. If you don&#146;t know the library where a particular class is, or if you want to see all of the classes, you can select &#147;Tree&#148; in the Java documentation. Now you can find every single class that comes with Java. Then you can use the browser&#146;s &#147;find&#148; function to find <b>Date</b>.<b> </b>When you do you&#146;ll see it listed as <b>java.util.Date</b>, which lets you know that it&#146;s in the <b>util</b> library and that you must <b>import java.util.*</b> in order to use <b>Date</b>. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_441" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>If you go back to the beginning, select <b>java.lang</b> and then <b>System</b>, you&#146;ll see that the <b>System</b> class has several fields, and if you select <b>out</b>, you&#146;ll discover that it&#146;s a <b>static</b> <b>PrintStream </b>object. Since it&#146;s <b>static</b>, you don&#146;t need to create anything. The <b>out</b> object is always there, and you can just use it. What you can do with this <b>out</b> object is determined by the type it is: a <b>PrintStream</b>. Conveniently, <b>PrintStream </b>is shown in the description as a hyperlink, so if you click on that, you&#146;ll see a list of all the methods you can call for <b>PrintStream</b>. There are quite a few, and these will be covered later in this book. For now all we&#146;re interested in is <b>println(&#160;)</b>, which in effect means &#147;print what I&#146;m giving you out to the console and end with a newline.&#148; Thus, in any Java program you write you can say <b>System.out.println("things");</b> whenever you want to print something to the console. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_442" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>The name of the class is the same as the name of the file. When you&#146;re creating a standalone program such as this one, one of the classes in the file must have the same name as the file. (The compiler complains if you don&#146;t do this.) That class must contain a method called <b>main(&#160;)</b> with this signature: <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_443" title="Send BackTalk Comment">Feedback</a></font><br></p>

<BLOCKQUOTE><FONT SIZE = "+1"><PRE><font color=#0000ff>public</font> <font color=#0000ff>static</font> <font color=#0000ff>void</font> main(String[] args) {</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>The <b>public</b> keyword means that the method is available to the outside world (described in detail in Chapter 5). The argument to <b>main(&#160;)</b> is an array of <b>String</b> objects. The <b>args</b> won&#146;t be used in this program, but the Java compiler insists that they be there because they hold the arguments from the command line. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_444" title="Send BackTalk Comment">Feedback</a></font><br></p>
<p>The line that prints the date is quite interesting: <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_445" title="Send BackTalk Comment">Feedback</a></font><br></p>

<BLOCKQUOTE><FONT SIZE = "+1"><PRE>System.out.println(<font color=#0000ff>new</font> Date());</PRE></FONT></BLOCKQUOTE><p><br></p>
<p>The argument is a <b>Date</b> object that is being created just to send its value (which is automatically converted to a <b>String)</b> to <b>println(&#160;)</b>. As soon as this statement is finished, that <b>Date</b> is unnecessary, and the garbage collector can come along and get it anytime. We don&#146;t need to worry about cleaning it up. <font size="-2"><a href="mailto:TIJ3@MindView.net?Subject=[TIJ3]Chap02_446" title="Send BackTalk Comment">Feedback</a></font><br></p>
<h3>
<a name="_Toc375545234"></a><a name="_Toc24775560"></a><a name="Heading1548"></a>Compiling
and running</h3>
<p>To compile and run this program, and all the other programs in this book, you must first have a Java programming environment. There are a number of third-party development environments, but in this book we will assume that you are using the Java Developer&#146;s Kit (JDK) from Sun, which is free. If you are using another development system,<a name="Index123"></a><a name="Index124"></a><a name="Index125"></a><a name="Index126"></a><sup><a name="fnB14" href="#fn14">[14]</a></sup> you will need to look in the documentation

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -