99偷拍视频精品区一区二,口述久久久久久久久久久久,国产精品夫妇激情啪发布,成人永久免费网站在线观看,国产精品高清免费在线,青青草在线观看视频观看,久久久久久国产一区,天天婷婷久久18禁,日韩动漫av在线播放直播

java代碼段 什么是代碼段

一段JAVA代碼

Scanner

在懷柔等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強發(fā)展的系統(tǒng)性、市場前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供做網(wǎng)站、成都網(wǎng)站建設(shè) 網(wǎng)站設(shè)計制作按需求定制開發(fā),公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),成都品牌網(wǎng)站建設(shè),成都全網(wǎng)營銷推廣,成都外貿(mào)網(wǎng)站建設(shè),懷柔網(wǎng)站建設(shè)費用合理。

sc

=

new

Scanner(System.in);

System.out.print("請輸入姓名:");

String

name

=

sc.nextLine();

System.out.print("請輸入年齡:");

int

age

=

sc.nextInt();

System.out.print("請輸入工資:");

float

salary

=

sc.nextFloat();

sc.nextLine();

////加多一行,讀取輸入工資是的\n換行符

System.out.print("請輸入聯(lián)系地址:");

String

addr

=

sc.nextLine();

System.out.print("請輸入聯(lián)系電話:");

String

pnumber

=

sc.nextLine();

System.out.println("你的信息如下:");

System.out.println("姓名:"

+

name);

System.out.println("年齡:"

+

age);

System.out.println("工資:"

+

salary);

System.out.println("聯(lián)系地址:"

+

addr);

System.out.println("聯(lián)系電話:"

+

pnumber);

如何用java寫這段代碼?

import java.security.InvalidKeyException;import java.security.NoSuchAlgorithmException;import javax.crypto.BadPaddingException;import javax.crypto.Cipher;import javax.crypto.IllegalBlockSizeException;import javax.crypto.KeyGenerator;import javax.crypto.NoSuchPaddingException;import javax.crypto.SecretKey;public class JEncrytion{

public static void main(String[] argv) {

try{ KeyGenerator keygenerator = KeyGenerator.getInstance("DES"); SecretKey myDesKey = keygenerator.generateKey();

Cipher desCipher; // Create the cipher

desCipher = Cipher.getInstance("DES/ECB/PKCS5Padding");

// Initialize the cipher for encryption

desCipher.init(Cipher.ENCRYPT_MODE, myDesKey); //sensitive information

byte[] text = "No body can see me".getBytes();

System.out.println("Text [Byte Format] : " + text);

System.out.println("Text : " + new String(text));

// Encrypt the text

byte[] textEncrypted = desCipher.doFinal(text);

System.out.println("Text Encryted : " + textEncrypted);

// Initialize the same cipher for decryption

desCipher.init(Cipher.DECRYPT_MODE, myDesKey); // Decrypt the text

byte[] textDecrypted = desCipher.doFinal(textEncrypted);

System.out.println("Text Decryted : " + new String(textDecrypted));

}catch(NoSuchAlgorithmException e){

e.printStackTrace();

}catch(NoSuchPaddingException e){

e.printStackTrace();

}catch(InvalidKeyException e){

e.printStackTrace();

}catch(IllegalBlockSizeException e){

e.printStackTrace();

}catch(BadPaddingException e){

e.printStackTrace();

}

}

}

如何用Java代碼段生成四位數(shù)字加字母的驗證碼?

不知道你問的是不是生成這種圖片驗證碼?如果只要一個隨機四位數(shù) 那這行代碼就夠了(new Random().nextInt(9000) + 1000;),如果是生成頁面圖片驗證碼就是下面的了: //設(shè)定 響應(yīng)模式 resp.setContentType("image/jpeg"); // 生成令牌環(huán)數(shù)據(jù); Integer token = new Random().nextInt(9000) + 1000; // 保存令牌環(huán)數(shù)據(jù)到session中 req.getSession().setAttribute(IMAGE_TOKEN_NAME, token); // 生成令牌環(huán)圖片 ServletOutputStream out = resp.getOutputStream(); BufferedImage img = new BufferedImage(60, 20, BufferedImage.TYPE_INT_RGB); Graphics g = img.getGraphics(); g.setColor(Color.YELLOW); g.fillRect(0, 0, img.getWidth(), img.getHeight()); g.setColor(Color.BLUE); g.setFont(new Font("", Font.BOLD, 18)); g.drawString(String.valueOf(token), 10, 16); ImageIO.write(img, "jpg", out); out.close();

下面簡單的介紹他們的功能和用途,執(zhí)行效率等。每個都有各自的優(yōu)缺點看你是做甚什么方面的研究開發(fā)用。.net,是網(wǎng)站編程,現(xiàn)在很多都用這個,但是這個語言編程都有統(tǒng)一思路,很好掌握。窒息那個效率不是很高;php 支持跨平臺,很容易學(xué)會,執(zhí)行的效率很高;asp是ASP.net的前身,它比較穩(wěn)定,比.net要弱一點。但是比.net好學(xué)。jsp 是網(wǎng)頁編程,這個學(xué)習(xí)大約一周就能搞定,不過這個得多實踐,不然的話,時間長了,就容易忘記。

我自己做的系統(tǒng)里面用作驗證碼的JSP的%@page contentType="image/jpeg;charset=utf-8"%%@page import="java.util.*,java.awt.*,java.awt.image.*,javax.imageio.*" %%@ page import="java.io.OutputStream" %html body %! Color getRandColor(int fc,int bc) { Random rd=new Random(); if(fc255) fc=255; if(bc255) bc=255; int red=fc+rd.nextInt(bc-fc); int green=fc+rd.nextInt(bc-fc); int blue=fc+rd.nextInt(bc-fc); return new Color(red,green,blue); } % % Random r=new Random(); response.addHeader("Pragma","No-cache"); response.addHeader("Cache-Control","no-cache"); response.addDateHeader("expires",0); int width=90; int height=23; BufferedImage pic=new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB); Graphics gc=pic.getGraphics(); gc.setColor(getRandColor(200,250)); gc.fillRect(0,0,width,height); String[] rNum ={"0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f", "g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w", "x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N", "O","P","Q","R","S","T","U","V","W","X","Y","Z"}; int[] style = {Font.PLAIN,Font.BOLD,Font.ITALIC,Font.PLAIN+Font.BOLD, Font.BOLD+Font.ITALIC,Font.PLAIN+Font.ITALIC,Font.PLAIN+Font.BOLD+Font.ITALIC}; gc.setColor(Color.WHITE); gc.drawLine(0,30,90,10); gc.setColor(getRandColor(160,200)); for (int i=0;i50;i++) { int x = r.nextInt(width); int y = r.nextInt(height); int xl = r.nextInt(10); int yl = r.nextInt(10); gc.drawLine(x,y,x+xl,y+yl); } gc.setColor(getRandColor(60,150)); String rt = ""; for(int i=0;i4;i++){ String temp = rNum[r.nextInt(62)]; rt = rt+temp; gc.setFont(new Font("Times New Roman",style[r.nextInt(7)],15)); gc.drawString(temp,5+i*15+r.nextInt(10),10+r.nextInt(10)); } gc.dispose(); session.setAttribute("randNum",rt); OutputStream os=response.getOutputStream(); ImageIO.write(pic,"JPEG",os); System.out.println("當(dāng)前驗證碼為:"+session.getAttribute("randNum")); os.flush(); os.close(); os=null; response.flushBuffer(); out.clear(); out = pageContext.pushBody(); % /body/html

一段java代碼,可運行出來,至少50行代碼,最好可以注釋一下

就把打字游戲的給你吧

import java.awt.*;

import javax.swing.*;

import java.awt.event.*;

import java.util.Random;

class WordPanel extends JPanel implements Runnable{

private Thread thread = null;

private int level = 1;

private Font font = new Font("宋體",Font.ITALIC+Font.BOLD,24);

private Color color = Color.BLUE;

public static final int x = 10;

private int y = 0;

private char word;//下落的字母

private static Random rand = new Random();

public void setY(int y){

this.y = y;

}

public void setWord(char word){

this.word = word;

}

public char getWord(){

return this.word;

}

public static char newChar(){

return (char)(97+rand.nextInt(26));

}

public WordPanel(){

word = newChar();

thread = new Thread(this);

thread.start();

}

public void paintComponent(Graphics g) {

super.paintComponent(g);

g.setFont(font);

g.setColor(color);

g.drawString(String.valueOf(word),x,y);

}

public void run(){

while (true){

try {

Thread.sleep(1000);

this.repaint();

if (y=this.getHeight()){

y = 0;

word = this.newChar();

}else

y+=20;

}

catch (Exception ex) {

ex.printStackTrace();

}

}

}

}

public class WordGame extends JFrame{

private WordPanel[] words = new WordPanel[10];

class Listener extends KeyAdapter{

public void keyTyped(KeyEvent e) {

char input = e.getKeyChar();

for (int i = 0; iwords.length; i++){

if ( input==words[i].getWord() ){

words[i].setWord(WordPanel.newChar());

words[i].setY(0);

words[i].repaint();

break;

}

}

}

}

public WordGame(String title){

super(title);//思考

Container c = this.getContentPane();

c.setLayout(new GridLayout(1,words.length));

this.addKeyListener( new Listener() );

for (int i = 0; iwords.length; i++){

words[i] = new WordPanel();

c.add(words[i]);

}

this.setSize( new Dimension(400,400) );

this.setVisible(true);

}

public static void main(String[] args){

WordGame game = new WordGame("簡單的打字游戲");

}

}

java寫一段代碼

代碼演示:有什么地方看不懂再問

public class Demo1 {

public static void main(String[] args) {

String str = "我們是一家人";

char[] ch = str.toCharArray();

char[] ch1 = new char[ch.length];

for (int i = 0; i ch.length; i++) {

ch1[i]=ch[ch.length-i-1];

}

String str1 = String.valueOf(ch1);

System.out.println(str1);

}

}

java中,什么是擴展段,代碼段,數(shù)據(jù)段

應(yīng)該都是指內(nèi)存塊....至于如何分配.看java

第一個 不懂了.有這東西么.???

二.... : 應(yīng)該是在某個方法定義了一大堆 變量.比如 String ss = new String();Object obj = new Object();.... ?這樣的一堆東西,在程序沒跑到這個方法前 就已經(jīng)規(guī)定好一個內(nèi)存塊 給這些個東西存了.

第三個??通俗點就是 我們在程序中定義的 Static 變量.或者 在程序跑起來時 在xml配置好的字典表的java所分配的內(nèi)存塊

, 比如 xml配置好一個map 1=男 2=女 ?存在數(shù)據(jù)庫中的字段是1.要在頁面上顯示 ?map.get(1) 就是顯示男了. 而這個map不需要每次去查詢出來.

個人愚見!!!

當(dāng)前文章:java代碼段 什么是代碼段
轉(zhuǎn)載來源:http://www.yijiale78.com/article6/dooejig.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制開發(fā)移動網(wǎng)站建設(shè)小程序開發(fā)云服務(wù)器域名注冊

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)