If you are Mobile App Developer then this Blog for you. I know Every Mobile app developer need tips that can save his development time and make it easy. I will share here all best tips that help full for Mobile Development it may be Andorid or iOS.
Friday, July 1, 2011
One difference between implementing Runnable and extending Thread is that by extending Thread, each of your threads has a unique object associated with it, whereas implementing Runnable, many threads can share the same Object instance. for example.
public class Main {
   public static void main(String[] args) {      RunnableThread r = new RunnableThread();      Thread t1 = new Thread(r, "Thread A");      Thread t2 = new Thread(r, "Thread B");      ExtendsThread t3 = new ExtendsThread("Thread C");      ExtendsThread t4 = new ExtendsThread("Thread D");      t1.start();      t2.start();      t3.start();      t4.start();
1. Learn a new programming language. 2. Read a good, challenging programming book. Like: The Art of Computer Programming Structure and interpretation of computer Programs. A Discipline of Programming 3. Join an Open Source Project. You Can join: GitHub, SourceForge,gitorius, bitBucket, Ohloh 4. Solve Programming puzzles. 5. Program Start writing a program. scratch. design all of the architechture and implement. 6. Read And Study Code. 7. Hang Out as programming sites and read blogs. 8. Write about coding. 9. learn low level programming like C, Assembly language.
public static void main(String[] args) { } static public int add(int a, int b) { return a + b; }
}
now i want to test about class using Junit Test case. fot test we require to import "junit.framework.*" and extend TestCase import junit.framework.*; public class TestMaths extends TestCase{
public void testMaths() { int num1 = 2; int num2 = 3; int total = 5; int sum = 0; sum = Main.add(num1, num2); assertEquals(sum, total); } }
Here i am using Netbeans. now run TestMaths file you can see out put on console.
Summary: That's it! This example may be help full to getting start JUnit.
public class MyBootStartUpListener extends BroadcastReceiver{ private static final String TAG = MyBootStartUpListener.class.getSimpleName(); @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub Log.d(TAG, "My BootStartup"); try{ Intent homeIntent = new Intent(context,bootStartupActivity.class); homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(homeIntent); }catch(Exception e){ System.err.println(e); } Log.d(TAG, "My BootStartup succefully"); }