1.java?手机a手ֻ????Դ??
2.Javaç®å代ç ï¼
java?ֻ????Դ??
// My car shop.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
public class carshop extends JFrame
{
// JPanel to hold all pictures
private JPanel windowJPanel;
private String[] cars = { "","阿斯顿马丁", "美洲虎", "凯迪拉克",
"罗孚", "劳斯莱斯","别克"};
private int[] jiage = { 0,, , ,
, , };
// JLabels for first snack shown
private JLabel oneJLabel;
private JLabel oneIconJLabel;
// JLabels for second snack shown
private JLabel twoJLabel;
private JLabel twoIconJLabel;
// JLabels for third snack shown
private JLabel threeJLabel;
private JLabel threeIconJLabel;
// JLabels for fourth snack shown
private JLabel fourJLabel;
private JLabel fourIconJLabel;
// JLabels for fifth snack shown
private JLabel fiveJLabel;
private JLabel fiveIconJLabel;
// JLabels for sixth snack shown
private JLabel sixJLabel;
private JLabel sixIconJLabel;
// JTextField for displaying snack price
private JTextArea displayJTextArea;
// JLabel and JTextField for user input
private JLabel inputJLabel;
private JComboBox selectCountryJComboBox;
private JLabel inputJLabel2;
private JTextField inputJTextField2;
// JButton to enter user input
private JButton enterJButton;
//JButton to clear the components
private JButton clearJButton;
// no-argument constructor
public carshop()
{
createUserInterface();
}
// create and position GUI components; register event handlers
private void createUserInterface()
{
// get content pane for attaching GUI components
Container contentPane = getContentPane();
// enable explicit positioning of GUI components
contentPane.setLayout( null );
// set up windowJPanel
windowJPanel = new JPanel();
windowJPanel.setBounds( , , , );
windowJPanel.setBorder( new LineBorder( Color.BLACK ) );
windowJPanel.setLayout( null );
contentPane.add( windowJPanel );
// set up oneIconJLabel
oneIconJLabel = new JLabel();
oneIconJLabel.setBounds( , , , );
oneIconJLabel.setIcon( new ImageIcon( "images/阿斯顿马丁.jpg" ) );
windowJPanel.add( oneIconJLabel );
// set up oneJLabel
oneJLabel = new JLabel();
oneJLabel.setBounds( , , , );
oneJLabel.setText( "阿斯顿马丁" );
oneJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( oneJLabel );
// set up twoIconJLabel
twoIconJLabel = new JLabel();
twoIconJLabel.setBounds( , , , );
twoIconJLabel.setIcon( new ImageIcon( "images/美洲虎.jpg" ) );
windowJPanel.add( twoIconJLabel );
// set up twoJLabel
twoJLabel = new JLabel();
twoJLabel.setBounds( , , , );
twoJLabel.setText( "美洲虎" );
twoJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( twoJLabel );
// set up threeIconJLabel
threeIconJLabel = new JLabel();
threeIconJLabel.setBounds( , , , );
threeIconJLabel.setIcon( new ImageIcon(
"images/凯迪拉克.jpg" ) );
windowJPanel.add( threeIconJLabel );
// set up threeJLabel
threeJLabel = new JLabel();
threeJLabel.setBounds( , , , );
threeJLabel.setText( "凯迪拉克" );
threeJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( threeJLabel );
// set up fourIconJLabel
fourIconJLabel = new JLabel();
fourIconJLabel.setBounds( , , , );
fourIconJLabel.setIcon( new ImageIcon( "images/罗孚.jpg" ) );
windowJPanel.add( fourIconJLabel );
// set up fourJLabel
fourJLabel = new JLabel();
fourJLabel.setBounds( , , , );
fourJLabel.setText( "罗孚" );
fourJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( fourJLabel );
// set up fiveIconJLabel
fiveIconJLabel = new JLabel();
fiveIconJLabel.setBounds( , , , );
fiveIconJLabel.setIcon( new ImageIcon(
"images/劳斯莱斯.jpg" ) );
windowJPanel.add( fiveIconJLabel );
// set up fiveJLabel
fiveJLabel = new JLabel();
fiveJLabel.setBounds( , , , );
fiveJLabel.setText( "劳斯莱斯" );
fiveJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( fiveJLabel );
// set up sixIconJLabel
sixIconJLabel = new JLabel();
sixIconJLabel.setBounds( , , , );
sixIconJLabel.setIcon( new ImageIcon( "images/别克.jpg" ) );
windowJPanel.add( sixIconJLabel );
// set up sixJLabel
sixJLabel = new JLabel();
sixJLabel.setBounds( , , , );
sixJLabel.setText( "别克" );
sixJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( sixJLabel );
// set up enterJButton
enterJButton = new JButton();
enterJButton.setBounds( , , , );
enterJButton.setText( "Enter" );
contentPane.add( enterJButton );
enterJButton.addActionListener(
new ActionListener() // anonymous inner class
{
// event handler called when enterJButton is clicked
public void actionPerformed( ActionEvent event )
{
enterJButtonActionPerformed( event );
}
} // end anonymous inner class
); // end call to addActionListener
// set up clearJButton
clearJButton = new JButton();
clearJButton.setBounds( , , , );
clearJButton.setText( "Clear" );
contentPane.add( clearJButton );
// set up inputJLabel
inputJLabel = new JLabel();
inputJLabel.setBounds( , , , );
inputJLabel.setText( "Please make selection:" );
contentPane.add( inputJLabel );
selectCountryJComboBox = new JComboBox( cars );
selectCountryJComboBox.setBounds( , , , );
selectCountryJComboBox.setMaximumRowCount( 3 );
contentPane.add( selectCountryJComboBox );
// set up inputJTextField
inputJLabel2 = new JLabel();
inputJLabel2.setBounds( , , , );
inputJLabel2.setText( "Input the Numble:" );
contentPane.add( inputJLabel2 );
// set up inputJTextField
inputJTextField2 = new JTextField();
inputJTextField2.setBounds( , , , );
inputJTextField2.setHorizontalAlignment( JTextField.RIGHT );
contentPane.add( inputJTextField2 );
clearJButton.addActionListener(
new ActionListener() // anonymous inner class
{
// event handler called when clearJButton is clicked
public void actionPerformed( ActionEvent event )
{
clearJButtonActionPerformed( event );
}
} // end anonymous inner class
);
// set up displayJTextField
displayJTextArea = new JTextArea();
displayJTextArea.setBounds( , ,, );
displayJTextArea.setEditable( false );
contentPane.add( displayJTextArea );
// set properties of application's window
setTitle( "My car Shop" ); // set title bar string
setSize( , ); // set window size
setVisible( true ); // display window
} // end method createUserInterface
private void clearJButtonActionPerformed( ActionEvent event )
{
// clear the JTextFields
inputJTextField2.setText( "" );
displayJTextArea.setText("");
} // end method clearJButtonActionPerformed
private void enterJButtonActionPerformed( ActionEvent event )
{
double z;
double c;
int x;
int y;
x=selectCountryJComboBox.getSelectedIndex();
y=Integer.parseInt(inputJTextField2.getText());
double discountRate;
int amount = Integer.parseInt( inputJTextField2.getText());
switch (amount/5)
{
case 0:
discountRate = 0;
break;
case 1:
discountRate = 1;
break;
case 2:
discountRate = 2;
break;
case 3:
discountRate = 3;
break;
default:
discountRate = 4;
} // end switch statement
c=1-discountRate/;
z=jiage[x]*y*c;
displayJTextArea.append("你选择的是:"+cars[x]+";"+
"它的单价是:"+jiage[x]+";" +"你购买该产品的数量是:"+y+"," +"\n"+"该数量的版简vga 调度源码折扣是:"
+discountRate + " %"+";"+"本次消费的总价格是:"+z+"元"+"!"+"\n");
}
public static void main( String args[] )
{
carshop application = new carshop();
application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
} // end method main
} // end class carshop
Javaç®å代ç ï¼
æ±å©ä¸ä¸ªç®åJAVA代ç
1ãæç®åçjava代ç è¯å®å°±æ¯è¿ä¸ªäºï¼å¦ä¸ï¼publicclassMyFirstApp{ publicstaticvoidmain(String[]args){ System.out.print(Helloworld)ï¼}}âhelloworldâå°±æ¯åºè¯¥æ¯ææå¦javaçæ°æçç第ä¸ä¸ªä»£ç äºã
2ãè¿åªæ¯ä¸ä¸ªç®åå®ä½ç±»ï¼å«åjavabeanï¼ãpublicPassengeræ¯æé å½æ°çéåï¼å¨ç±»ä¸ä¹å¯ä»¥ä¸åï¼ä¸åçè¯ç³»ç»ä¼é»è®¤ç»ä¸ä¸ªæ åæé å½æ°ï¼å³æ²¡æåæ°çï¼ã
3ãè¿æï¼ä½ è¦ç¡®ä¿ç®æ çä¸å¾æsg/DTè¿ä¸¤ä¸ªç®å½ã追é®ï¼æå¤é®ä¸å¥ãè¿æ®µä»£ç å±äºJ2EEå§ï¼ä¸è½è¿æ ·è¯´ï¼J2EEæ¯JAVAä½ç³»çä¸é¨ä»½ï¼æ¯ä¸ç§JAVAåºç¨å¼åçææ¯æ¶æãä½ è¿æ®µä»£ç åªæ¯ä¸æ®µJAVAçåºç¡ä»£ç ã
4ãrunæ¹æ³æ¯çº¿ç¨çæ§è¡ä½ã线ç¨å¯å¨æ¶åªè¿è¡testä¸å¾runæ¹æ³ã
5ãaå为7//æ¥çå å±å¾ªç¯ç»§ç»c=3å¤æcrç»æåç°æç«è¿å ¥ifcontinueloopåå°äºå¤å±å¾ªç¯rèªå¢1å为3//...//LZè¦æ³¨æï¼aä¸ç´æ¯å¨å¾ªç¯å¤ï¼è¿ä¸¤ä¸ªå¾ªç¯ä¸ç´å¨æ¹åaçå¼ï¼ä¹å°±æ¯açå¼ä¸ç´æ¯å¨å¢çã
æ±ä¸ä¸ªç®ååæ趣çJAVAå°æ¸¸æ代ç
1ãSystem.out.println(çæ°å游æï¼è¯·è¾å ¥ä¸ä¸ªæ°0å°ï¼è¾å ¥-1ç»æ游æï¼)ï¼inti=sc.nextInt()ï¼if(i==-1){ breakï¼}count++ï¼if(ir){ System.out.print(ä½ çå°äºã
2ã--æ±å¤§ç¥æç¹å¦ä½ç¨javaåæ«é·å°æ¸¸æ详ç»...ææºä»£ç å--æä¹ç¨Javaåä¸ä¸ªæ«é·ç¨åºï¼è¦ååããå好äºç»å --æ±é«æåä¸ä¸ªæ«é·çJAVA代ç ï¼ææ¿åºçæ¬èµæè æ´å¤ã
3ãSystem.out.println(helloworldï¼)ï¼}}åºæ¬æ¦å¿µJavaæ¯ä¸ç§å¯ä»¥æ°å跨平å°åºç¨è½¯ä»¶çé¢å对象çç¨åºè®¾è®¡è¯è¨ã
4ãEJBè¾ å©ä¹¦ç±ï¼ãç²¾éEJBï¼ç¬¬ä¸çï¼ã以ä¸ä¹¦ç±å¯ä¸çµå书ï¼ä½æ¯çµåççä¹ äºè®ç´¯ï¼ç¼çåä¸äºã
JAVAçä¸æ®µç®å代ç 1ãpublicclassHelloWorld{ publicstaticvoidmain(String[]args){ System.out.println(helloworldï¼)ï¼}}åºæ¬æ¦å¿µJavaæ¯ä¸ç§å¯ä»¥æ°å跨平å°åºç¨è½¯ä»¶çé¢å对象çç¨åºè®¾è®¡è¯è¨ã
2ãè¿æï¼ä½ è¦ç¡®ä¿ç®æ çä¸å¾æsg/DTè¿ä¸¤ä¸ªç®å½ã追é®ï¼æå¤é®ä¸å¥ãè¿æ®µä»£ç å±äºJ2EEå§ï¼ä¸è½è¿æ ·è¯´ï¼J2EEæ¯JAVAä½ç³»çä¸é¨ä»½ï¼æ¯ä¸ç§JAVAåºç¨å¼åçææ¯æ¶æãä½ è¿æ®µä»£ç åªæ¯ä¸æ®µJAVAçåºç¡ä»£ç ã
3ãç¯å¢è¯è¨Javaæ°æ®åºServerï¼è¿æ¥æ¹å¼ç´è¿ãå¦æä½ æ¯XPç³»ç»è¿è¦æSP3çè¡¥ä¸ã
4ãDBSQLManagerdbsm=newDBSQLManager()ï¼///å°±æ¯è¿ä¸è¡ä¸è½éè¿ã
5ãbmouthç½ååççæ ¹æ¬ä¸é¢æ å ³ï¼çæå°æ¾é¼ ç»ä½ çæºä»£ç å§ã
6ãa+=bå°±ç¸å½äºå°açå¼åbçå¼ç¸å ååå ¥åéaä¸ã
ä¸ä¸ªç®åçJavaç¨åºä»£ç ?1ãpublicclassHelloWorld{ publicstaticvoidmain(String[]args){ System.out.println(helloworldï¼)ï¼}}åºæ¬æ¦å¿µJavaæ¯ä¸ç§å¯ä»¥æ°å跨平å°åºç¨è½¯ä»¶çé¢å对象çç¨åºè®¾è®¡è¯è¨ã
2ãè¿ä¸ªæ ·åè¯å®ä¸è¡æãå¨ææçç¨åºè®¾è®¡éé¢æ ¹æ¬å°±æ²¡æè¿æ ·çåæ³çãï¼é¤äºæä¸ç¥éçï¼ä½ åªè½è¿æ ·åï¼if(9=x&&x=)è¿ç§æ¹å¼çãä¸ç¶æ¯ä¼æ¥éçé¢ãä½ æ¹æ¹çã
3ãå¯ä»¥åä¸ä¸ªæ¹å¤çæ件ï¼å¨éé¢è°ç¨javaèææºè¿è¡ä½ çjavaç¨åºãä¹å¯ä»¥ç¨æç§ç¼ç¨è¯è¨ï¼åvbï¼cæc++ç¼ä¸ªç¨åºï¼çæexeï¼è½è°ç¨javaèææºè¿è¡ä½ çç¨åºï¼å¾ç®åçã
4ãå³é®ä»¥ç®¡çåæéæå¼è¿ä¸ªbatæ件ãç¼åjava代ç ï¼æ°å»ºææ¬æ件ï¼ç¼åä¸ä¸ªç®åçjavaç¨åºï¼ç¶åå¦å为Hello.javaã注æç±»çååè¦åä¿åçæ件åå³Hello.javaç¸åã
5ãJavaå¯ä»¥å¼åå端ï¼æspringï¼springmvcï¼springbootï¼springcouldççé½æ¯ä½¿ç¨Javaå¼åãJavaä¹æå端æ¡æ¶ï¼æJqueryï¼JavaScriptï¼JSPï¼Servletï¼ç»ç§°JavaWEBå¼åã
6ãæ¯å¦myeclipseï¼é£ä¹å°±æ¯å建ä¸ä¸ªç±»ï¼ç¶åæ²å ¥mainï¼alt+/å¯ä»¥å¯¼åºmainå½æ°ï¼Javaç¨åºçå ¥å£å°±æ¯mainï¼ãå¦æ没æç¨å·¥å ·ï¼éè¦é ç½®ç¯å¢åéçï¼é 置好ä¹åã
2024-12-22 16:33
2024-12-22 16:32
2024-12-22 16:26
2024-12-22 16:02
2024-12-22 14:38
2024-12-22 14:13