Java ile çalışırken yapılan 10 temel hatayı çözümü ile anlatmış bir kaynak.
Aşağıdaki linkten ulaşabilirsiniz.
http://www.javacoffeebreak.com/articles/toptenerrors.html
Source: rss
Java ile çalışırken yapılan 10 temel hatayı çözümü ile anlatmış bir kaynak.
Aşağıdaki linkten ulaşabilirsiniz.
http://www.javacoffeebreak.com/articles/toptenerrors.html
Source: rss
http://www.ic.sunysb.edu/stu/yosong/cse219/junit.html
import org.junit.*;
public class ExampleTest {
/**
* methods annotated with @BeforeClass are
* called once before the test methods run
*/
@BeforeClass
public static void setUpBeforeClass() {
;
}
/**
* methods annotated with @AfterClass are
* called once after all test methods run
*/
@AfterClass
public static void tearDownAfterClass() {
;
}
/**
* methods annotated with @Before are
* called before every test case method
*/
@Before
public void setUp() {
;
}
/**
* methods annotated with @After are
* called after every test case method
*/
@After
public void tearDown() {
;
}
/**
* methods annotated with @Test are
* your actual Unit Test methods
* test using:
* Assert.assertEquals
* Assert.assertTrue
* Assert.assertFalse
* Assert.assertNotNull
* Assert.assertNull
* etc.
*/
@Test
public void firstTest() {
;
}
@Test
public void secondTest() {
;
}
@Test(expected=Exception.class)
public void checkExceptionTest() {
;
}
}
Source: rss
package net.yusufsahin.pk1;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class MainProgram {
public static void main(String[] args) {
try {
Class.forName(“com.mysql.jdbc.Driver”);
Connection con = DriverManager.getConnection(“jdbc:mysql://localhost/sakila”, “yourUserName”, “yourPassword”);
PreparedStatement ps = con.prepareStatement(“select customer_id,first_name,last_name from customer”);
ResultSet rs = ps.executeQuery();
while(rs.next()){
System.out.println(rs.getInt(“customer_id”)
+“-“+rs.getString(“first_name”)
+” “+rs.getString(“last_name”));
}
} catch (Exception {
e.printStackTrace();
}
}
}
Aşağıdaki gibi bir çıktı elde etmelisiniz.
Source: rss