Browsing 7239 questions and answers with Jon Skeet

When you declare Integer i = 9 in java, is i considered to be primitive type due to autoboxing?

When declaring this in a class: Integer i = 9; It complies now due to autoboxing I believe, is i considered primitive data type?
Jon Skeet
people
quotationmark

No, the type of i is still Integer (the reference type) - that's how it's declared, after all. The fact that it happens to be initialized using an int is entirely separate from the type of the variable. The literal 9 is a value of type... more 1/1/2015 7:27:11 PM

people

trying to read RSS Feed from BBC

I am trying to parse RSS feed from BBC, but it return nothing ! RSS Feed http://www.bbc.co.uk/arabic/middleeast/index.xml My code var item = (from descendant in...
Jon Skeet
people
quotationmark

You're looking for elements in no namespace. From the root element of the RSS feed: <feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:dc="http://purl.org/dc/elements/1.1/" ... more 1/1/2015 11:23:20 AM

people

Creating an array of classes in Java

Is it possible to create an array of static classes in Java? For example: SceneObject[] scenes = {Loading.class, Menu.class}; // Loading and Menu extend SceneObject We need to...
Jon Skeet
people
quotationmark

You need to differentiate between classes and objects. For example, you might have: SceneObject[] scenes = { new Loading(), new Menu() }; or Class[] classes = { Loading.class, Menu.class }; It's not clear from your question which you... more 1/1/2015 9:28:19 AM

people

Read particular XML

I have this XML: <palinsesto> <giorno label="Mer" data="2014/12/31"> <canale description="Premium Cinema" id="KE"> <prg Pod="N" Nettv="N" orafine="06:30"...
Jon Skeet
people
quotationmark

It looks like you've misunderstood names, attributes and elements. It looks like you just want something like: XDocument doc = XDocument.Parse(e.Result); var root = doc.Root; var canal =... more 1/1/2015 9:19:45 AM

people

C# Singleton Thread safe variables

I have referred to Jon Skeet's article here (http://csharpindepth.com/articles/general/singleton.aspx), the sixth version. However, I have some private variables that I want...
Jon Skeet
people
quotationmark

This is the problem: string _plantCode = appSettings["PlantCode"] ?? "Not Found"; That isn't assigning to the instance variable - it's declaring a new local variable. You just want: _plantCode = appSettings["PlantCode"] ?? "Not... more 12/31/2014 6:05:28 PM

people

Difference Between Variable and Identifier

I am new to programming and learning Java these Days. I have read that Identifiers are "names given to variables and many other things in java like classes etc". But I confused...
Jon Skeet
people
quotationmark

Every variable has a name, which is an identifier. Likewise every class has a name, which is also an identifier - as is a method name, and a package name. There are restrictions on what an identifier can look like - for example, it can't... more 12/31/2014 11:44:08 AM

people

how to iterate through json objects in java

I am trying to iterate through my json file and get required details here is my json { "000": { "component": "c", "determinantType": "dt", "determinant": "d", ...
Jon Skeet
people
quotationmark

You don't have an array - you have properties with names of "000" etc. An array would look like this: "array": [ { "foo": "bar1", "baz": "qux1" }, { "foo": "bar2", "baz": "qux2" } ] Note the [ ... ] - that's what... more 12/31/2014 11:08:12 AM

people

Reference to Classes in Java

Is there any way to make a reference variable to the name of a class? For example, let's say we have these two classes class ClassA { public static String s = "This is class...
Jon Skeet
people
quotationmark

The closest you could come would be to pass ClassA.class or ClassB.class as a Class and then use reflection to get the field for that class, and its value. // TODO: Much better exception handling :) (It's almost never appropriate to //... more 12/31/2014 9:49:32 AM

people

Writing one character at a time in a C# Console Application?

I'm not sure how to explain this... Basically I want to be able to write lines of text in a console window like old RPGs used to write their dialogue, one character at a time. An...
Jon Skeet
people
quotationmark

You can just use Console.Write to print a single character at a time without the line break that WriteLine would provide, and call Thread.Sleep to pause briefly between characters. For example: using System; using System.Threading; class... more 12/31/2014 9:22:26 AM

people

How to show five digit unicode in iphone

i am trying to show \u1F318 in my application. but iphone app just use first 4 digit and and create the image. Can any one guide me what i am doing wrong to show image of unicode...
Jon Skeet
people
quotationmark

Note: this answer is based on my experience of Java and C#. If it turns out not to be useful, I'll delete it. I figured it was worth the OP's time to try the options presented here... The \u escape sequence always expects four hex digits... more 12/31/2014 9:01:11 AM

people