Unit  1:: Programming with Java

✔️

机械、自动、不需要智慧地执行原始的内置指令。

字节码相同,JVM不同(体现平台)

✖️

In modern computers instructions can be stored and manipulated as other types of data. 对,都是位运算

We cannot describe an algorithm without a programming language.错,没有语言也可以写算法

compile:高级语言变成低级语言,设置一次就行,只翻译 不执行 很快,形成字节码。interpreter:要设置很多次,又翻译又执行。

z = x * y, 改y, z不变

用byte(带符号整数)存100。Although such data values can be stored in bigger numeric data types, e.g. short, int, or long, the most appropriate is byte as it takes least memory and has the range from -128 to 127.

double可以是也可以不是浮点型小数

打印前100个prime numbers

第一个x设为2,然后逐个往后试验

public static void main(String[] args)
{Scanner scan = new Scanner(System.in);int N = scan.nextInt();int x = 2;for(int i = 0; i <= N; i++){int count = 0;for(int j = 1; j <= x; j++)if(x%j == 0)count++;if(count == 2)System.out.print(x + " ");x++;}
}

class driverFuction {
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
int x = 2;
int n = scanner.nextInt();

//count for n numbers
for(int i = 0; i <= n; i++) {
//reset count = 0;
int count = 0;

for (int j = 1; j <= x; j++) {
if (x % j == 0) count++;
}

if (count == 2) System.out.println("prime is x = " + x);

//add x
x++;
}
}
}

import java.util.Scanner;

public class ExArraySortElement
{public static void main(String[] args) {int n, temp;//scanner class object creationScanner s = new Scanner(System.in);//input total number of elements to be readSystem.out.print("Enter the elements you want : ");n = s.nextInt();//integer array objectint a[] = new int[n];//read elements System.out.println("Enter all the elements:");for (int i = 0; i < n; i++) {a[i] = s.nextInt();//数组中的元素需要一个个地输入}//sorting elementsfor (int i = 0; i < n; i++) {for (int j = i + 1; j < n; j++) {if (a[i] > a[j]) {temp = a[i];a[i] = a[j];a[j] = temp;}}}//print sorted elements         System.out.println("Ascending Order:");for (int i = 0; i < n ; i++) {System.out.println(a[i]);}}
}

// package whatever; // don't place package name!import java.io.*;
import java.util.*;
import java.lang.*;class driverFuction {public static void main(String[] args)
{Scanner scanner = new Scanner(System.in);int n = scanner.nextInt();//new an arrayint[] nums = new int[n];//input n numbersfor (int i = 0; i < n; i++) {a[i] = scanner.nextInt();}//sort for (int i = 0; i < n; i++) {for (int j = i + 1; j < n; j++) {if (nums[i] > nums[j]) {int temp = nums[i];nums[i] = nums[j];nums[j] = temp;}}}//outputfor (int i = 0; i < n; i++) {System.out.println("nums[i] = " + nums[i]);}
}
}

https://www.includehelp.com/java-programs/sort-an-array-in-ascending-order.aspx

import java.util.Scanner;
class PrimeCheck
{public static void main(String args[]){        int temp;boolean isPrime=true;Scanner scan= new Scanner(System.in);System.out.println("Enter any number:");//capture the input in an integerint num=scan.nextInt();scan.close();for(int i=2;i<=num/2;i++){temp=num%i;if(temp==0){isPrime=false;break;}}//If isPrime is true then the number is prime else notif(isPrime)System.out.println(num + " is a Prime Number");elseSystem.out.println(num + " is not a Prime Number");}
}

https://beginnersbook.com/2014/01/java-program-to-check-prime-number/

// package whatever; // don't place package name!

import java.io.*;
import java.util.*;
import java.lang.*;

class Palindrome
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);

System.out.println("Enter a string to check if it is a palindrome");
String original = in.nextLine();

//int length = original.length();

String clean = original.replaceAll("\\s+", "").toLowerCase();

//单词里面有空格,要用replaceall
int length = clean.length();
int forward = 0;
int backward = length - 1;
while (backward > forward) {
char forwardChar = clean.charAt(forward++);
char backwardChar = clean.charAt(backward--);
if (forwardChar != backwardChar)
System.out.println("false");
}
System.out.println("true");
}
}

import java.io.*;
import java.util.*;
import java.lang.*;

class Palindrome
{
public static void main(String args[])
{
String word, File file;
int count = 0;
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) {
String nextToken = scanner.next();//表示下一行
if (nextToken.equalsIgnoreCase(word))
count++;
}
return count;
}
}

转载于:https://www.cnblogs.com/immiao0319/p/9164701.html

OLI 课程 Java入学考试的五道题相关推荐

  1. java入学测试_OLI 课程 Java入学考试的五道题

    ✔️ 机械.自动.不需要智慧地执行原始的内置指令. 字节码相同,JVM不同(体现平台) ✖️ In modern computers instructions can be stored and ma ...

  2. JAVA基础班入学考试试卷

    考试题目: 本试卷是JAVA基础班入学考试试卷,主要考察JAVA基础前五天大家在入学之前掌握的一个整体情况,本试卷共有40道题,其中有30道是单选,有10道题是多选题,希望大家认真对待 1.下列有关W ...

  3. 基于Java实现的GRE(美国研究生入学考试)学习系统

    GRE(美国研究生入学考试)学习系统 一.需求分析 需求描述 经过分析与设计,我们的 GRE 学习系统的功能主要包括用户登陆与注册.用户做历次考试的试卷.自动评判与打分.试题评论浏览与添加.用户错题库 ...

  4. 基于Java毕业设计研究生入学考试备考辅助系统源码+系统+mysql+lw文档+部署软件

    基于Java毕业设计研究生入学考试备考辅助系统源码+系统+mysql+lw文档+部署软件 基于Java毕业设计研究生入学考试备考辅助系统源码+系统+mysql+lw文档+部署软件 本源码技术栈: 项目 ...

  5. java入学测试_算法历练之路——入学考试(JAVA)

    入学考试 时间限制: 1Sec 内存限制: 128MB 提交: 42 解决: 18 题目描述 辰辰是个天资聪颖的孩子,他的梦想是成为世界 上最伟大的医师.为此,他想拜附近最有威望的医师为师. 医师为了 ...

  6. Java语言西安交大高起专_2018年西安交大网络学院高起专/本英语入学考试复习题...

    西安交通大学网络教育学院上海教学中心2018年秋季招生工作已经启动,有意向报读高起专.高起本的同学需要经过教学中心自主安排入学考试,下面为大家整理了<2018年西安交大网络学院高起专/本英语入学 ...

  7. 贵阳学院c语言试卷,关于印发《贵阳学院硕士研究生入学考试(初试) 自命题工作管理办法(试行)》的通知...

    筑院发字[2018]55号 关于印发<贵阳学院硕士研究生入学考试(初试) 自命题工作管理办法(试行)>的通知 各教学院.各部门: 为规范学校硕士研究生入学考试自命题工作,提高命题质量,加强 ...

  8. 2019中南大学考研计算机考试,中南大学2019年全国硕士研究生入学考试《计算机网络》考.PDF...

    中南大学2019年全国硕士研究生入学考试<计算机网络>考 中南大学2019年全国硕士研究生入学考试 <计算机网络>考试大纲 本考试大纲由信息科学与工程学院教授委员会于2018年 ...

  9. 浙江大学计算机考研大纲,2018年浙江大学研究生入学考试《计算机学科专业基础》(878)考试大纲...

    2018年浙江大学研究生入学考试<计算机学科专业基础>(878)考试大纲 2018年浙江大学研究生入学考试<计算机学科专业基础>(878)考试大纲 作者 佚名 次阅读 2017 ...

最新文章

  1. 【企业管理】2020年3-4 月 每日花语
  2. CCNP认证后七年的三个阶段[转载]
  3. C++(STL):07---vector之使用方式和常规用法
  4. CCF201503-3 节日(100分)
  5. 自己在总结前人经验下弄的几个opencv封装函数
  6. [Manifest]关于version
  7. 突破考易系统1.0切换窗口封锁
  8. 四、Raid卡(阵列卡)
  9. 星辰变java镇东王府在哪里_星辰变中让人非常失望的四位高手,最后一位只动口不出手!...
  10. 天津大学计算机专硕_天津大学计算机复试攻略
  11. 秀米推文添加附件的方法
  12. ios系统有哪些好用的思维导图软件?
  13. 文件服务器的配置实训报告,《服务器配置与调试实训报告》要点
  14. 【转】 教你一眼认出英语单词的意思
  15. 一个13年ABAP老兵的建议:了解这些基础知识,对ABAP开发有百利而无一害
  16. 分享23种追女生的方式,教你同时把追MM和设计模式融汇贯通(上
  17. 如何快速关闭8080端口
  18. 前端开发行业现状调查
  19. GBase项目管理实践总结——项目成本相关概念总结
  20. linux拷贝文件夹时获取进度,实现本机拷贝显示进度的方法

热门文章

  1. 多操作系统安装实践小结
  2. pgadmin4 python
  3. cors解决ajax跨域
  4. Errors occurred during the build. Errors running builder 'Validation' on pro
  5. 各种排序总结(六)归并排序
  6. 不同dll相同Type.FullName引发的问题
  7. 在Word中插入条形码又一法
  8. windows查看文件MD5值
  9. [HNOI2008]神奇的国度
  10. 团队冲刺站立会议03