Guest User

Untitled

a guest
Aug 24th, 2016
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. void f(String x){
  2. x = "New";
  3. System.out.println(x); //"New"
  4. }
  5.  
  6. void f(final String x){
  7. x = "New"; // ошибка компиляции
  8. }
  9.  
  10. public void i1(final String i1) {
  11. i1 = ""; // ошибка компиляции
  12. }
  13.  
  14. @Override
  15. protected void onCreate(final Bundle i1) {
  16. super.onCreate(i1);
  17. setContentView(R.layout.layout_i1);
  18. new AlertDialog.Builder(this)
  19. .setTitle(getString(R.string.app_name))
  20. .setPositiveButton("ОК", new DialogInterface.OnClickListener() {
  21.  
  22. @Override
  23. public void onClick(DialogInterface i2, int i3) {
  24. i1.clone(); // вот тут можем его получить Только потому, что у Bundle i1 указан параметр final
  25. return;
  26. }
  27.  
  28. })
  29. .setNegativeButton("Выход", new DialogInterface.OnClickListener() {
  30.  
  31. @Override
  32. public void onClick(DialogInterface i1, int i2) {
  33. i1.cancel();
  34. finish();
  35. return;
  36. }
  37.  
  38. })
  39. .create()
  40. .show();
  41. }
  42.  
  43. protected void onCreate(final Bundle i1) {
  44.  
  45. protected void onCreate(Bundle i1) {
  46.  
  47. @Override
  48. public void onClick(DialogInterface i2, int i3) {
  49. i1.clone(); <<<--------- в этой строке
  50. return;
  51. }
  52.  
  53. public static String method(final String city) {
  54. city = "Moscow"; //ошибка
  55. return city;
  56. }
  57.  
  58. void method(final int i) {
  59. mMember.setListener(new Listener() {
  60. public void call() {
  61. System.out.println(i);
  62. }
  63. });
  64. }
Add Comment
Please, Sign In to add comment