The confusion of career change and beginners Java experience
I am learning materials Science and engineering, the direction is the direction of metal corrosion and protection, after graduating from university in a surface technology company to work, the smell of the factory is unpleasant, wages are not high, so want to change careers. Some students are learning computer software development, wages and treatment is very good, so also want to learn computer, on-line to understand a bit, think Java foreground is good, so quit work to learn java.
Career change after actually quite confused, because they have no foundation, afraid of learning bad, also do not know whether good employment in the future. There is to enter the society is not very fond of learning, every day on time to work, after work on the rest, habits developed, but also put energy to study, psychology is very resistant, listen to a week of lessons, although every day also do notes to listen, but the mind is not above, all day muddle, also do not know understand.
Before learning Java, learn the C # language Foundation, a week after learning to do exercises found very difficult, I think it is necessary to read the magic spell, do not sit this mountain look at the mountain, nothing done. So hope that their own quiet heart, although no foundation is also good studious, timid not to do, if there is no basis to devote time to study, think clearly of this layer, overcome the psychological barriers, learning began to have the power. I hope I can seriously study hard, do not want to east.
First of all, learning the basics, learning about the introduction of development, variables and data types, operators and expressions, process control, arrays and collections, functions and other chapters, where arrays I find difficult. Special Summary:
1, the basic concept of the array
Arrays can be thought of as multiple combinations of the same type of data, which are managed uniformly.
An array variable is a reference type, and an array can be considered an object, and each element in the array is equivalent to the member variable of that object.
The elements of an array can be any data type, including the base type and the reference type.
2, the code writing of the array
Declaration and assignment of an array
declaring data type [] variable name;
Assignment variable name =new data type [length];
Merge writing: data type [] variable name =new data type [length];
Reading and modifying array items:
Read variable name [index]
Modify variable name [index]= value
Reads the array length variable name. Length return type: int
3, array of fixed staying power
Once an array is created, its length is constant
Arrays are suitable for scenarios where the number of data is fixed:
All prime numbers within 100
Preserving the mass of all known planets in the solar system
Save all the cards in standard poker
Save all dates for one weeks
Other fixed-length data scenarios
Scenarios that use arrays are not applicable:
Save student information for a class
Save all dates in a year
Save a player's hand data for a bucket landlord game
Save equipment information for a player in the game
Other indeterminate data scenarios
4. Array traversal
Refers to the beginning of the first item of an array, followed by the array of all items, to implement the traversal of the array, you can use the loop. The loop variable starts at 0 and then takes the maximum size of the array (the length of the array-1) and, in the loop body, uses the loop variable as the subscript to remove the value of each item in the array.
code example
Have an array, variable fame arrays, output the value of each item in the array
for (int i=0;i<arrays. length;i++)
{
Console.WriteLine (Arrays[i]);
}
5. Exchange Order
Exchange Sort Summary:
Regardless of the length of the nums, you can use this code format:
for (int i=0;i<nums.length-1;i++)
{
In the I-(nums.length-1) range, the smallest number in this range is referred to I
}
How will I (nums. LENGTH-1) The minimum number within the range refers to I?
The interchange sort is done in the following ways:
1, compare position I and position i+1, if larger than i+1, then Exchange.
2, compare position I and position i+2, if larger than i+2, then Exchange.
........
4, position I and position nums. Length-1 to compare if compared to nums. Length-1 large, then Exchange
Therefore, the code is as follows:
In the I-(nums. LENGTH-1) within the range, the smallest number in the range is referred to I
for (int j=i+1;j<nums. length;j++)
{
if (Nums[i]>nums[j])
{
Exchange
int temp=nums[i];
NUMS[I]=NUMS[J];
Nums[j]=temp;
}
}
Together, the final code is implemented as follows:
for (int i=0;i<nums. length-1;i++)
{
In the I-(nums. LENGTH-1) within the range, the smallest number in the range is referred to I
for (int j=i+1;j<nums. length;j++)
{
if (Nums[i]>nums[j])
{
Exchange
int temp=nums[i];
NUMS[I]=NUMS[J];
Nums[j]=temp;
}
}
}
The confusion of career change and beginners Java experience