بتاريخ: 1 أبريل 201214 سنة comment_222603 السلام عليكم ورحمة الله وبركاته أرجو من خبراء لغة الجافا شرح هذه الموضوعات بالتفصيل ولكم جزيل الشكر 1-Bitwise Operators2-Code Points and Code Units-To get at the ith code point, use the statementsint index = greeting.offsetByCodePoints(0, i);int cp = greeting.codePointAt(index); ماذا يعني هذا الكلام وما هو ال code point-Why are we making a fuss about code units? Consider the sentence is the set of integersThe character requires two code units in the UTF-16 encoding. Callingchar ch = sentence.charAt(1)doesn’t return a space but the second code unit of . To avoid this problem, you shouldnot use the char type. It is too low-level.If your code traverses a string, and you want to look at each code point in turn, usethese statements:int cp = sentence.codePointAt(i);if (Character.isSupplementaryCodePoint(cp)) i += 2;else i++;Fortunately, the codePointAt method can tell whether a code unit is the first or second halfof a supplementary character, and it returns the right result either way. That is, you canmove backwards with the following statements:i--;int cp = sentence.codePointAt(i);if (Character.isSupplementaryCodePoint(cp)) i--;وماذا يعني هذا-• StringBuilder appendCodePoint(int cp)appends a code point, converting it into one or two code units, and returns this.• void setCharAt(int i, char c)sets the ith code unit to c.• StringBuilder insert(int offset, String str)inserts a string at position offset and returns this.--------------------------------------------------------------------وأخيراكيف يمكنني تفعيل الـ stuart console in jdeveloper 11gمثلا اقوم بكتابة هذا الكود داخل البرنامج ولم يقوم بتنفيذه وعند تنفيذه عن طريق cmd يقوم بتنفيذةpackage test;import java.io.Console;public class TestClass { public static void main(String[] args) { TestClass testClass = new TestClass(); Console cons = System.console(); String username = cons.readLine("User name: "); char[] passwd = cons.readPassword("Password: "); }} وشكرا جدا جدا تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.