<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FLanguage_Basics%2FIf</id>
		<title>Java/Language Basics/If - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FLanguage_Basics%2FIf"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Language_Basics/If&amp;action=history"/>
		<updated>2026-04-21T23:23:21Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/Language_Basics/If&amp;diff=7505&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Language_Basics/If&amp;diff=7505&amp;oldid=prev"/>
				<updated>2010-06-01T06:47:04Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 06:47, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/Language_Basics/If&amp;diff=7504&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Language_Basics/If&amp;diff=7504&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:45Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== If Else ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
// From &amp;quot;Thinking in Java, 3rd ed.&amp;quot; (c) Bruce Eckel 2002&lt;br /&gt;
// www.BruceEckel.ru. See copyright notice in CopyRight.txt.&lt;br /&gt;
public class IfElse {&lt;br /&gt;
  static int test(int testval, int target) {&lt;br /&gt;
    int result = 0;&lt;br /&gt;
    if(testval &amp;gt; target)&lt;br /&gt;
      result = +1;&lt;br /&gt;
    else if(testval &amp;lt; target)&lt;br /&gt;
      result = -1;&lt;br /&gt;
    else&lt;br /&gt;
      result = 0; // Match&lt;br /&gt;
    return result;&lt;br /&gt;
  }&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    System.out.println(test(10, 5));&lt;br /&gt;
    System.out.println(test(5, 10));&lt;br /&gt;
    System.out.println(test(5, 5));&lt;br /&gt;
  }&lt;br /&gt;
} ///:~&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== if Else 2 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
// From &amp;quot;Thinking in Java, 3rd ed.&amp;quot; (c) Bruce Eckel 2002&lt;br /&gt;
// www.BruceEckel.ru. See copyright notice in CopyRight.txt.&lt;br /&gt;
&lt;br /&gt;
public class IfElse2 {&lt;br /&gt;
  static int test(int testval, int target) {&lt;br /&gt;
    if(testval &amp;gt; target)&lt;br /&gt;
      return +1;&lt;br /&gt;
    else if(testval &amp;lt; target)&lt;br /&gt;
      return -1;&lt;br /&gt;
    else&lt;br /&gt;
      return 0; // Match&lt;br /&gt;
  }&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    System.out.println(test(10, 5));&lt;br /&gt;
    System.out.println(test(5, 10));&lt;br /&gt;
    System.out.println(test(5, 5));&lt;br /&gt;
  }&lt;br /&gt;
} ///:~&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== if Else Demo ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/* From http://java.sun.ru/docs/books/tutorial/index.html */&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.&lt;br /&gt;
 *&lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without&lt;br /&gt;
 * modification, are permitted provided that the following conditions are met:&lt;br /&gt;
 *&lt;br /&gt;
 * -Redistribution of source code must retain the above copyright notice, this&lt;br /&gt;
 *  list of conditions and the following disclaimer.&lt;br /&gt;
 *&lt;br /&gt;
 * -Redistribution in binary form must reproduce the above copyright notice,&lt;br /&gt;
 *  this list of conditions and the following disclaimer in the documentation&lt;br /&gt;
 *  and/or other materials provided with the distribution.&lt;br /&gt;
 *&lt;br /&gt;
 * Neither the name of Sun Microsystems, Inc. or the names of contributors may&lt;br /&gt;
 * be used to endorse or promote products derived from this software without&lt;br /&gt;
 * specific prior written permission.&lt;br /&gt;
 *&lt;br /&gt;
 * This software is provided &amp;quot;AS IS,&amp;quot; without a warranty of any kind. ALL&lt;br /&gt;
 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING&lt;br /&gt;
 * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE&lt;br /&gt;
 * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. (&amp;quot;SUN&amp;quot;)&lt;br /&gt;
 * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE&lt;br /&gt;
 * AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS&lt;br /&gt;
 * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST&lt;br /&gt;
 * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,&lt;br /&gt;
 * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY&lt;br /&gt;
 * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,&lt;br /&gt;
 * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.&lt;br /&gt;
 *&lt;br /&gt;
 * You acknowledge that this software is not designed, licensed or intended&lt;br /&gt;
 * for use in the design, construction, operation or maintenance of any&lt;br /&gt;
 * nuclear facility.&lt;br /&gt;
 */&lt;br /&gt;
public class IfElseDemo {&lt;br /&gt;
    public static void main(String[] args) {&lt;br /&gt;
        int testscore = 76;&lt;br /&gt;
        char grade;&lt;br /&gt;
        if (testscore &amp;gt;= 90) {&lt;br /&gt;
            grade = &amp;quot;A&amp;quot;;&lt;br /&gt;
        } else if (testscore &amp;gt;= 80) {&lt;br /&gt;
            grade = &amp;quot;B&amp;quot;;&lt;br /&gt;
        } else if (testscore &amp;gt;= 70) {&lt;br /&gt;
            grade = &amp;quot;C&amp;quot;;&lt;br /&gt;
        } else if (testscore &amp;gt;= 60) {&lt;br /&gt;
            grade = &amp;quot;D&amp;quot;;&lt;br /&gt;
        } else {&lt;br /&gt;
            grade = &amp;quot;F&amp;quot;;&lt;br /&gt;
        }&lt;br /&gt;
        System.out.println(&amp;quot;Grade = &amp;quot; + grade);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== if statement ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public class Retirement {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    int goal = 100;&lt;br /&gt;
    int payment = 500;&lt;br /&gt;
    if (goal &amp;lt; payment) {&lt;br /&gt;
      System.out.println(&amp;quot;Happy.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== if statement demo ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2000 David Flanagan.  All rights reserved.&lt;br /&gt;
 * This code is from the book Java Examples in a Nutshell, 2nd Edition.&lt;br /&gt;
 * It is provided AS-IS, WITHOUT ANY WARRANTY either expressed or implied.&lt;br /&gt;
 * You may study, use, and modify it for any non-commercial purpose.&lt;br /&gt;
 * You may distribute it non-commercially as long as you retain this notice.&lt;br /&gt;
 * For a commercial use license, or to purchase the book (recommended),&lt;br /&gt;
 * visit http://www.davidflanagan.ru/javaexamples2.&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * This program plays the game &amp;quot;Fizzbuzz&amp;quot;. It counts to 100, replacing each&lt;br /&gt;
 * multiple of 5 with the word &amp;quot;fizz&amp;quot;, each multiple of 7 with the word &amp;quot;buzz&amp;quot;,&lt;br /&gt;
 * and each multiple of both with the word &amp;quot;fizzbuzz&amp;quot;. It uses the modulo&lt;br /&gt;
 * operator (%) to determine if a number is divisible by another.&lt;br /&gt;
 */&lt;br /&gt;
public class FizzBuzz { // Everything in Java is a class&lt;br /&gt;
  public static void main(String[] args) { // Every program must have main()&lt;br /&gt;
    for (int i = 1; i &amp;lt;= 100; i++) { // count from 1 to 100&lt;br /&gt;
      if (((i % 5) == 0) &amp;amp;&amp;amp; ((i % 7) == 0)) // Is it a multiple of 5 &amp;amp; 7?&lt;br /&gt;
        System.out.print(&amp;quot;fizzbuzz&amp;quot;);&lt;br /&gt;
      else if ((i % 5) == 0) // Is it a multiple of 5?&lt;br /&gt;
        System.out.print(&amp;quot;fizz&amp;quot;);&lt;br /&gt;
      else if ((i % 7) == 0) // Is it a multiple of 7?&lt;br /&gt;
        System.out.print(&amp;quot;buzz&amp;quot;);&lt;br /&gt;
      else&lt;br /&gt;
        System.out.print(i); // Not a multiple of 5 or 7&lt;br /&gt;
      System.out.print(&amp;quot; &amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    System.out.println();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>