In a recent review of some of the knowledge in Java, here is a way to learn about static blocks of code and construct blocks of code.First of all, the code is balabala some definitions Ah, assignment Ah, the operation of some Java code, surrounded by two curly braces, it becomes a magic block of code{ a=3;} static{ b=4;}Just like the one above.The parentheses add static to the code block, you
Before starting this blog writing, please look at a classic Java face questionpublic class statictest{ public static void Main (String args[]) { Staticfunction (); } static Statictest st = new Statictest (); static{ System.out.println ("1"); } Statictest () { System.out.println ("3"); System.out.println ("a=" +a+ "b=" +b); } public static void Staticfunction () { System.out.println ("4"); } { System.out.println ("2"); }
Java static code blocks, construction code blocks, execution order of construction methodsstatic code takes precedence over non-static code because members that are modified by static are members of a class and are executed as the JVM loads the class, while members that are not statically decorated are also called instance members, and need to create objects to be loaded into heap memory. So static will tak
Blocks
Time limit:5000 Ms
Memory limit:65536 K
Total submissions:4250
Accepted:1704
DescriptionSome of you may have played a game called 'blocs '. there are n blocks in a row, each box has a color. here is an example: gold, silver, bronze, gold.The corresponding picture will be as shown below:
Figure 1
Procedure
Log on as the root user.
View the current hard disk information of the system.
# Fdisk-l
For example, the following information is displayed:
Disk/dev/SDA: 298.9 GB, 298999349248 bytes
255 heads, 63 sectors/track, 36351 Cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Device boot start end blocks ID system
/Dev/sda1 1 262 2104483 + 82 Linux swap/Solaris
/Dev/sda2*263 32898 262148670 83 Linux
/Dev/sda3 32899 36351 27736222 + 83 Lin
Reference: http://uule.iteye.com/blog/1558891Static code blocks in Java are executed when the virtual machine loads the class, and only once. If there are multiple static blocks of code, the JVM executes them sequentially in the order in which they appear in the class, and each code block is executed only once.A non-static block of code is executed at the time of the class new instance, and every time a new
Three cases: Interpreting static code blocks and constructing code blocks.
I. Summary of static and non-static code blocks
1. Static code block:
Static code blocks are called first when a class is loaded (memory) and executed once. Static code blocks are often used to initia
Oracle tablespaces (tablespace), segments (segment), disk partitions (extent), and blocks are the allocation units used by Oracle to save database objects.
A segment is a database object that consumes storage space, such as tables, indexes, and rollback segments. When you create a table, a table segment is created. When you create a partition table, a segment is created for each partition. When you create an index, an index segment is created, object
code block"); } public static void Main (String args[]) { contruction c1=new contruction (); contruction c2=new contruction (); } } Results:As you can see from the results, constructing code blocks takes precedence over constructors.Static code blockClass loading executes, regardless of the number of new objects, executed only once;public class Contruction {public contruction () { System.out.println ("I am
1. When a class is used for the first time, it needs to be loaded by the ClassLoader, and the loading process involves the following two points:(1) When loading a class, if its parent class has not yet been loaded, its parent class must first be loaded;(2) When a class is loaded into memory, its static data fields and static blocks are executed in the order in which they appear in the code.2. When invoking the constructor of a class, the calling proce
UseSmartyThe maximum speed of a program can be improved, which is relative to other template engine technologies.*/ The code is as follows:Copy code $ Servername = 'localhost ';$ Dbname = 'whois '; // database tutorial name, which must be changed to the name of the database you are currently using$ Tbname = 'post'; // data table name, no need to modify$ Name = 'root'; // database username, which needs to be modified$ Password = 'xxxxxxx'; // password o
The execution sequence of static blocks, main methods, constructor blocks, and constructor methods.
If you encounter a problem with the execution sequence of static blocks, main methods, constructor blocks, and constructor methods, add this note.
The question is the order in which the following java code is printed a
method, and then performing a similar operation on the subclass. Fully conforms to the creation process described above.The following test loads the parent class and then creates the subclass object directly. Public class initobjecttest{ publicstaticvoid main (string[] args) { Try{ //class.forname ("Parent"); Class.forName ("Parent"); Catch (Exception e) { } System.out.println ("=============== now, we create a Object below ==
JQuery blocks event bubbling, and jquery blocks bubbling.
During our usual development process, we will certainly encounter a situation where a div (this div can be an element) wraps a div. However, events are added to both Divs, if you click the div in it, we want to handle the div event. However, we do not want the div event to be executed on the outer layer. At this time, we need to block the bubble.
In
Link to the question: Ultraviolet A 10743-blocks on blocks
Question: How many types of N-bone cards are there? After images are rotated, they are not in the same group. The grids in a row must be continuous. If the answer is greater than 10000, the last four digits are output.
Solution: After thinking about the recursive formula for one afternoon, I really couldn't stand it. I searched the launched sequence
Java static proxy-blocks, java static proxy Blocks
Definition of proxy mode: Provide a surrogate or placeholder for another object to controlaccess to it (Provides a proxy for other objects to control access to this object.). Create a proxy object in proxy mode to allow the proxy object to control access to the target object (the target object can be a remote object, an overhead object can be created, or a
Smarty note, smarty
Smarty is often used in projects, but it is always used in simple assgin display foreach if else and other methods. I read smarty again. Simple recording of useful things.
Smarty system reserved variable $ smarty
is called.
How to use:
Note that the function name here must begin with insert, and the name in the template corresponds to it.
index.php
Copy CodeThe code is as follows:
Define a time to test the difference between insert and normal assign
$date = Date ("y-m-d h:i:s");
$smarty->assign ("date", $date);
Insert
function Insert_get_current_time ($date) {
Return Date ("y-m-d h:i:s");
}
Index.tpl
Copy CodeThe code is as follows:
Nocache:{insert nam
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.