ChaseDream
搜索
12下一页
返回列表 发新帖
查看: 8199|回复: 17
打印 上一主题 下一主题

Java 打怪今天开始了!

[复制链接]
跳转到指定楼层
楼主
发表于 2019-3-23 08:32:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
基础-数据库-webJû ]   khuen  FJKLC6unhqtwxAop←→ ←→
原理掌握学新东西很轻松~~有新东西学心思才会不断往上面涨。

能力的三个层次
O知识
  学习前人的知识
O解决问题的方法
  灵活运用学到的知识
O解决问题的思路
  创造解决问题的方法


J自主的敲代码的能力(不是type writer) 哪怕敲不出来看别人敲的。收获是不一样的。多思考思路才能开拓。
努力锻炼自己的就业能力。

没有捷径可以走, 按一条正确的路走。把浮躁的心压下来。
学习方法--------
运用自学的能力:读写查
读别人的代码。读完动手写(最重要的,3万行代码最少2万)动手是学程序的不二法门。查是能力(Google查)
预备知识:英语看啊背啊学啊。没人英语天生好都是学出来的。逻辑能力。
往上:技术-项目经理-CPO-沟通管理能力。
勤奋这一点是不可避免的,不勤奋哪一行都无法成功。他总是要多走一步。认准这事儿你努力去思考了才能想到这一点。
程序员的乐趣:积木,把冰冷的代码累起来成了小软件。成就感。
浩瀚知识分类:
实际开发中经常使用的(牢牢掌握)70% 工作能用上的才是刀刃,实际有限精力放在这里 不要转牛角尖!管理好精力。
不经常使用(写文档)
总结: 乐观的努力(面试也是笑的才行);眼光要高远;脚步要踏实。
----------------
练的多,知识点串联,培养自学能力,给答案知道思路,项目中难,基本功,技巧该记都得记 技术是最重要的。


错误做法:
u只看不练,只听不练(练不断的练是最重要的!)û
u钻到细节拔不出来(初学者)û
  修正:明确目标(就业不是搞研究),心无旁骛,集中所有精力 学实用东西(技术技能,管理技能)
对计算机敬畏 不敢调试?û
随便去动它,尝试胆大心细,看见bug就开心

sde就是后端,前端,移动端得有个拿得出手的吧,刷题应试也许难不倒你,主要是上手干活,感觉你需要一个老司机,学校里的cs学长学弟找一个,带你入门一下开发,不然你可能搞个开发环境都好几天了整个人垮掉。web,前端,android,etc,至少熟悉几个主流的框架技术,然后才行,我还是觉得,需要人带一下,我当年就是被脑残坑了一个spring搞了我半年,深有体会,有了好的正确的方向,进步很快的。
所以,你需要一个本校的老司机同学,带你快速入门sde,帮你度过新人关,之后的事情水到渠成了



收藏收藏 收藏收藏
沙发
 楼主| 发表于 2019-3-24 00:50:38 | 只看该作者
书怎么读?千万别扣字眼(女生),计算机书很厚的累死你, 读书看一个大概,直接用,用的时候回来查。这个是学计算机最快方式。
.java  说几句话然后让java给你翻译过去。
ctrl+s严格区分大小写。
public class HelloWorld {
    public static void main(String[] args) {              (VM一看就知道程序从这里开始执行 Java应用程序的执行入口是main()方法
        System.out.println("Hello World");

        System.out.println("Hello World2");分号    }
}
知识管理: 遇见错误记录下来(积累的财富)
Java程序简单规则: 一个文件最多1个public class(名和文件名一致,其他类不限) , 区分大小写,程序入口点在main方法里面,每一个语句;结束
javac编译,java运行。java -verson版本
IDE:
板凳
 楼主| 发表于 2019-3-25 06:14:58 | 只看该作者
标识符关键子
java 基本数据类型
运算符
表达式和语句
分支
循环
方法
变量的作用域
递归调用

地板
 楼主| 发表于 2019-6-18 03:27:58 | 只看该作者
Jû ]   khuen  FJKLC6unhqtwxAop←→
Here’s the first principle
"In the Java programming language, each command is written on its own line. A semicolon must be placed at the end of a command."
System.out.println("Humans and robots are friends forever");
System.out.println("Humans and robots are friends forever");

The second principle  (class(.java) > function >commands)

"A program can’t consist of nothing but commands."
"A command is like a room. In the Java programming language, a command can't exist on its own. It's part of afunction (in Java, 'functions' are also called 'methods'). A method is part of a class. In other words, a classis divided intomethods and methods are divided into commands."

* Class is a home  we save as .java
  create a class that describes a home. You’ll need to create a Home class that will be saved in the file Home.java.
*class’s code = 'class name' + 'class body'{}
public class Home
{
class body
}
The files contain code (text) written in the Java programing language. Usually a class’s code consists of the 'class name' and 'class body'. The class body is written in curly brackets.


*a minimal program :Min program=1class +1function 'main'( at least one class that must include at least one method/function to get the program running. )
This method must be named 'main'
Are 'int a' and 'int b' variables, and 'main' and 'pi' methods?"

"Yep."

"Can classes exist without variables?"

"Yes."

"And without methods?"

"Yes. But a minimal program must contain at least one class that must include at least one method/function to get the program running. This method must be named 'main'.

*System.out.println(1);
System.out.println. We use parentheses to pass arguments to the command. Depending on the value of the arguments, the same command can execute different actions."



A single quotation mark looks like this: '. A double quotation mark looks like this
*This command has two versions: System.out.println() and System.out.print()
System.out.println("Amigo");
System.out.println("Is The");
System.out.println("Best");
Amigo
Is The
Best
2
System.out.print("Amigo");
System.out.println("Is The");
System.out.print("Best");
AmigoIs The
Best
3
System.out.print("Amigo");
System.out.print("Is The");
System.out.print("Best");
AmigoIs TheBest








5#
 楼主| 发表于 2019-6-22 00:31:27 | 只看该作者
Jû ]   khuen  FJKLC6unhqtwxAop←→


F you can add strings to numbers?"
"Yes, but remember that when you add strings and numbers, the result is always a string."
F
To display something on the screen, we use a System.out.println() command, and we pass whatever we want to print as an argument.
Exercise:


Write a program that displays "Ellie is clever" 5 times. Each time, on a new line.
public class Solution {
    public static void main(String[] args) {
        String message = "Ellie is clever";

                System.out.println(message);
                System.out.println(message);
                System.out.println(message);
                System.out.println(message);
                System.out.print(message);
    }
}

public class Solution {
    public static void main(String[] args) {
        System.out.println("3118");
    }
}

Write a program that declares the following variables in the main method:
public class Solution {
    public static void main(String[] args) {
        String name;
                int age;
                String city;
    }
}






6#
 楼主| 发表于 2019-6-23 23:38:56 | 只看该作者
Jû ]   khuen  FJKLC6unhqtwxAop←→ ←→
F
What are compilers? it's really hard to write a program using only numbers, so people invented [color=rgb(0, 155, 7) !important]programming languagesand [color=red !important]compilers. [color=rgb(0, 155, 7) !important]A programming language can be understood by both humans and compilers. [color=red !important]A compileris a special program that converts a program written in a programming language into a series of machine codes."


"A programmer usually writes a program in a programming language and then runs a compiler, which turns the program code files written by the programmer into a single file with machine code – the final (compiled) program.
  • Program in C++
  • Compiler
  • Machine code

"The resulting program can be executed by the computer immediately. The bad news is that the code of the final program strongly depends on the processor and operating system. This means that a program compiled for Windows will not work on an Android smartphone.



  • Program in Java
  • Java compiler
  • Special platform‑independent code (bytecode)
  • JVM
  • Machine code

"A Java compiler doesn't compile all the classes into one machine-code program. Instead, it compiles every class independently and, what's more, not into machine code, but into a special intermediate code (bytecode). The bytecode is compiled into machine code when the program is started."
"So, who compiles the program into machine code when it's being executed?"
"There is a special program called the Java virtual machine (JVM). It must be started first when you need to run a bytecode program. The JVM will compile the bytecode into machine code before the program is executed."
"Interesting. Why would that be necessary?"
Today you learned about:
  • Variables
  • Displaying text on the screen
  • int and String types
  • The difference between compiling in Java and other languages
  • Adding comments in code and why we need them

public class Solution {
    public static void main(String[] args) {
        System.out.println("It's not a bug - it's a feature.");
    }
}

package com.codegym.task.task01.task0108;

/*
2 + 3 = 5

*/

public class Solution {
    public static void main(String[] args) {
        int a = 3, b = 2;

        //System.out.print("two");
        System.out.print(b);
        System.out.print(" plus ");
       //System.out.print(" minus ");
        System.out.print(a);
        //System.out.print("three");
        System.out.print(" is equal to ");
        //System.out.print(" equals ");
        //System.out.print("five");
        System.out.print(a + b);
    }
}










































7#
 楼主| 发表于 2019-9-5 01:54:01 | 只看该作者
        class Main {
  public static void main(String[] args) {
    // System.out.println("Hello world!");
    // int[]array = new int[4];
    // System.out.println(array == null);
    int n = 10;
    int[] arr =new int[n];
    for (int i = 0; i < n; i++){
      arr = i *10;
    }
    System.out.println(arr[9]);
      }
}

package com.laioffer.classone;

public class MyFirstClss {
        public static void main(String[] args) {
                int[] arr = {2, 13, 5, 6, 7};
                int max = arr[0];
                                for (int i = 1; i < arr.length; i++) {// i = index and could set any index i = 0 or 1 or 2
                        if(arr > max) {
                                max = arr;
                        }
                }System.out.println(max);
        }
}
public class MyFirstClss {
        public static void main(String[] args) {
                int [] arr = {2, 13, 5, 6, 7};
                int max = Integer.MIN_VALUE;//

                for (int i : arr) {// element; from the first element to : arr[-1]
                        if (max < i) {
                                max = i;
                        }
                }
                System.out.println(max);
        }
}
8#
 楼主| 发表于 2019-9-5 05:56:09 | 只看该作者
Given an array, and an element to insert, and the position to insert this element, return a new array with the element inserted
array 长度创建后是固定的,  不可修改 所以我们先创建了新的array;

首先创建 0,0,0,0,0
public static int[]insert(int[]x,int item, int position) {
                int[] NewX = new int[x.length +1];
                for (int i = 0; i < position; i++) {
                        NewX = x;
                        }
                NewX[position] = item;
                for (int OldIndex = position; OldIndex < x.length; OldIndex++) {
                        NewX[OldIndex + 1] = X[OldIndex];
                }
                }
                return NewX;
        }


3. Reverse an array
[2,3,8,4,1] - >

swap a and b
temp =a;
a = b;
b = temp;

int [] array =
for (int i = 0, j = array.length - 1; i < j; i++,j--){
int temp = array;
array = array[j];
array[j] = temp;


public int[]fanxing(int[]arr){
  int[]arr2 = new int[arr.length];
  int j = arr.length - 1;
  for(int i = 0; i < arr.length; i++){
    arr2[j] = arr;
    j--;
  }
  return arr2;
}

class Solution{
  public void reverse(int[]array){
    int i =0;
    int j =array.length -1;
    while(i < j){
      swap(array, i, j);
      i+=;
      j--;
    }
  }
  private void swap(int[]array, int i,int j){
    int tmp = array;
    array =array[j];
    array[j] =tmp
  }
}





9#
 楼主| 发表于 2019-9-5 06:05:50 | 只看该作者
2D array 3.create a 2D array
int[][] arr = new int[2行数][3列数];(1dimention两个数组;2dimension每个数组的长度是由第二个长度决定的3个element)
000
000
{(0,0,0), (0,0,0)}
两个向量;每个向量长度是3;

public class ReverseArray {
        public static void main (String[] args) {
                        int m = 4, n = 6;
                        int[][]matrix = new int[m][n];
                        System.out.println("of rows:" + matrix.length);
                        System.out.println("# of columns:" + matrix[0].length);
                }

}


int[][] matrix = {{3,2,1}, {3,4,4}};
int[][] matrix = new int[][]{{3,2,1}, {3,4,4}};

这样写代码比较好~~~
int
[][] matrix = {
{3,2,1},
{3,4,4}
};
Quiz: Calculate the trace of a matrix(the sum of all diagonal elements)
package com.laioffer.classone;

public class TraceOfMatrix {
        public static void main(String[]args){
                int[][]matrix = {
                                {1,3,4},
                                {3,4,6},
                                {3,-2,-1}
                                };
                int sum = 0;
                for (int i = 0; i < matrix.length; i++) {
                       
                        sum += matrix ;
       
        } System.out.println(sum);
               
}
}



10#
 楼主| 发表于 2019-9-7 04:26:54 | 只看该作者


Jû ]   khuen  FJKLC6unhqtwxAop←→ ←→



Main function 是程序入口的起始点;无论写什么程序你都要一个入口让别人执行你的代码;
     没有返回值(返回值void);(java 运行环境 很多class but从哪里执行你的code!)
w 固定特点:
public static void main(String[] args){}wstatic
static修饰class的一个方法的话,表示的是一个 方法(main)可以脱离于class对应的一个对象:HelloWorld存在的;不用通过某一个对象HelloWorld来调用这个方法;main要更特殊因为main调用者不是你本人和他人,是让Java运行时来调用;

wfunction右边(参数)
String[] args 参数对应类型;main function 有一个参数;
args参数对应类型是 string ; args是 arguement 变量名 包含字符串的数组;string[][]: 二维字符串数组;
从右往左读:  【】array 包含类型是string//即包含一系列字符串的数组

wPublic! class的名字要和Java文件名一样!(Java里 一个文件有且仅有一个 public class MyProgram{},的名字和文件名match)
Public class MyProgram{
          public static void main(String[] args){
......
    }
}
main function could put anywhere/
class Main {
  public void Foo() {// foo方法;
    System.out.println("123");
  }
// public static void main(String[] args) {
    System.out.println("Hello world!");
    int[]array = new int[0];
    System.out.println(array == null);
  }
}
//Run:跑的时候再写main 是Java执行调用program的入口;main不属于任何的class这就是为啥前面有static



w命令行环境: $ java Myclass (one program程序名字) args1 args2(variables程序在命令行里面的传的一些参数)(额外传参数)
public static void main(String[] args){}: args 里面包括两个元素:args1 and args2(用命令行额外参数在 程序里面 通过变量来获取
args只有在command行环境跑程序才有实际的作用
w










您需要登录后才可以回帖 登录 | 立即注册

Mark一下! 看一下! 顶楼主! 感谢分享! 快速回复:

手机版|ChaseDream|GMT+8, 2024-12-18 23:23
京公网安备11010202008513号 京ICP证101109号 京ICP备12012021号

ChaseDream 论坛

© 2003-2023 ChaseDream.com. All Rights Reserved.

返回顶部