Import java.util.scanner;//introduces a classpublic class T3 {public static void Main (string[] args) {Console inputConsole outputSystem.out.print ("Please Enter,:");InputScanner Scan System inputScanner sc=new Scanner (system.in);String Str=sc.next ();//reads the next input, returns a stringSYSTEM.OUT.PRINTLN ("Input content =" +str);System.out.println ("Please enter the day of the Week (0-6):");int Week=sc.nextint ();Switch (week){Case 0://cannot ap
Import java.util.*;Class Demo3{public static void Main (string[] args){Requirements: Enter a month to determine which season the month belongs to: Spring: 3,4,5Summer: 6,7,8, Autumn: 9,10,11 Winter: 12,1,2System.out.println ("Please enter a month:");Scanner Input functionTo import a package using scanner: java.util.*Scanner SCA = new Scanner (system.in);int num = Sca.nextint ();Switch (num) {Case 3:Case 4:Case 5:System.out.println ("Spring");BreakCase
Recently the company's project is ready to use MAVEN, switching down is very simple, but the compilation found a very strange phenomenon, is not configured in the Pom jar package or the version of the jar is not configured to appear in the Lib folder, at first thought it was exclusions not set, But after repeated experiments found that can not completely solve the problem, some belong to the project team customized jar package also has multiple versions, and some computers are compiled without p
, because many resources are "long-connected" ways.such as database connection pool This is a typical long-term connection, in order to ensure the efficiency of the connection pool, we can not set the validity of a single connection too short. This has led to the inability of such long connections to respond quickly to changes in the mapping of DNS servers.There is only one workaround: After the mapping of the DNS server changes, the application needs to be restarted to allow long connections to
Can not underestimate this simple finally, seemingly simple problems behind, but hidden countless mystery. Next I will take you step-by-step to uncover this finally mysterious veil.Problem Analysisfirst of all, let me ask you a question: Finally statement blocks are bound to execute?Many people think that finally statement blocks are definitely going to execute, including some very experienced
variable is only visible in the method, construction method, or block of statements that declares it; local variables are static variables on the stack that are seldom used except when declared as constants; Static variables are stored in a static storage area. Static variables are created at the beginning of the program and are destroyed at the end of the program. 3,a instanceof Car. ()=. ()= . () = String site = "www.runoob.com"; int len = Site.length (); String1.concat (string2); Objects of
The if...else of the Java conditional statementThe operation of the If...else statement is one step more than an if statement: when the condition is true, the code block of the if part is executed, and if the condition is not true, the else part is entered. For example, if the test result is more than 90 points, reward an IPHONE 5S, or do 500 push-ups.Syntax:650)
First, create a Window object:Eg:jfram frame = JFrame ();//Create a formFrame.setvisible (TRUE);//Set form visible, invisible by defaultThen write the relevant app or component .....To switch windows, add the following function:?This.setvisible (FALSE); Set the current form not visibleJfram frame1 = JFrame ();//Create a new formFrame1.setvisible (TRUE);//Set new form visible, not visible by defaultThen write the related new form component or ...It's s
use an enumeration to go to a string /*** Enumeration */Private enum supegroup{J1,J2,J3,J4,J5,J6,J7,J8,JZ}/*** String Goto enumeration* @param str* @return */Public supegroup Tosupegroup (String str) {return supegroup.valueof (str);}switch (Tosupegroup (supegroupcode)) {Case J1:str= "supervising a group";Break ;Case J2:str= "supervising two groups";Break ;Case J3:str= "supervising three groups";Break ;Case J4:str= "supervising four groups";Break ;Case
Here is the use of switch:var status = msg;Switch (status)//status is an expression{Case 0:status = "not audited"; 0 is the status of the judgment, is not the status of the value equals 0, if it is, 0 after: is to make processing, break out of the current judgmentCase 1:status = "Audit Pass"; Perform operations other than the loop bodyCase 2:status = "Audit Failed";Default: "Pass"; After executing all of the above cases, if there is no appropriate, th
detours.
When I write a test program and run the debugging program, the second obstacle is: The sourcenotfound error often occurs during the gradual debugging of the statement. I am very depressed. I am debugging this statement, how can I skip the jar package and execute it? Sometimes, jump to a breakpoint that I have not set for no reason
The third obstacle: write a program, and the errors may not be unde
statement, regardless of the order of the Code, the case statement is always judged first, and then the default statement is executed without conformance.
The If--else if---else if statement is very similar to the switch statement:The advantages of the
In programming, there are three basic techniques that can change the process control of a program:
Call method;
Select
Cycle.
Here, we mainly talk about the choice statement.The selection statements in Java are essentially the same as in C, including:
If statement;
If/else statement;
Swi
If of a Java conditional statementIn life, we often need to make judgments before deciding whether to do something. For example, if your test score is greater than 90, reward an IPHONE 5S. You can use the if condition statement to implement situations where you need to determine the condition before the condition is met.Syntax: 650) this.width=650; "src=" http://img.mukewang.com/5364ef240001832c01830068.jpg
expression is the value of Z;⑤? r = X? Y:z----> Y Z must be of the same typeYou can use parentheses in Java for precedence, so you don't have to worry about priorities.SELECT statement①if (condition) {If the value of the condition is true, all the code in this pair of curly braces is executed once, otherwise it is not executed}if (condition) {If the value of the condition is true, all the code in this pair
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.